InstallingPage.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "InstallingPage.h"
  2. #define HaveNetColor 0xFF477EDE
  3. #define NoNetColor 0xFFB5B6B8
  4. InstallingPage::InstallingPage(CPaintManagerUI* m_pm)
  5. {
  6. this->m_pm = m_pm;
  7. InitControls();
  8. InitLanguage();
  9. }
  10. InstallingPage::~InstallingPage()
  11. {
  12. LayoutInstalling = NULL;
  13. InstallingProgress = NULL;
  14. pTabSwitch = NULL;
  15. ConNoNetWork = NULL;
  16. installNotWork = NULL;
  17. installingValue = NULL;
  18. InstallingProgress = NULL;
  19. }
  20. void InstallingPage::InitControls()
  21. {
  22. LayoutInstalling = static_cast<CVerticalLayoutUI*>(m_pm->FindControl(UI_LayoutInstalling));
  23. InstallingProgress = static_cast<CProgressUI*>(m_pm->FindControl(UI_InstallingProgress));
  24. pTabSwitch = static_cast<CTabLayoutUI*>(m_pm->FindControl(UI_tab_switch));
  25. ConNoNetWork = static_cast<CControlUI*>(m_pm->FindControl(UI_ConNoNetWork));
  26. installNotWork = static_cast<CLabelUI*>(m_pm->FindControl(UI_installNotWork));
  27. installingValue = static_cast<CLabelUI*>(m_pm->FindControl(UI_installingValue));
  28. }
  29. void InstallingPage::InitLanguage()
  30. {
  31. installNotWork->SetText(UIstr(TextType::Text_NoNetwork));
  32. }
  33. CDuiString InstallingPage::UIstr(TextType textType)
  34. {
  35. CDuiString duiStr(CLanguage::GetText(textType).c_str());
  36. return duiStr;
  37. }
  38. void InstallingPage::InitValue()
  39. {
  40. }
  41. void InstallingPage::SetProgressValue(int value)
  42. {
  43. std::wstring progressText = std::to_wstring(value) + L"%";
  44. installingValue->SetText(progressText.c_str());
  45. InstallingProgress->SetValue(value);
  46. }
  47. #pragma region UI界面变化
  48. void InstallingPage::NetWorkUI(bool isNet)
  49. {
  50. if (isNet)
  51. {
  52. //有网时,显示有网界面
  53. ConNoNetWork->SetVisible(false);
  54. pTabSwitch->SetVisible(true);
  55. InstallingProgress->SetForeColor(HaveNetColor);
  56. installNotWork->SetText(CLanguage::GetDuiText(TextType::Text_Installing));
  57. }
  58. else
  59. {
  60. //断网时,显示断网界面
  61. ConNoNetWork->SetVisible(true);
  62. pTabSwitch->SetVisible(false);
  63. InstallingProgress->SetForeColor(NoNetColor);
  64. installNotWork->SetText(CLanguage::GetDuiText(TextType::Text_NoNetwork));
  65. }
  66. }
  67. #pragma endregion