CFrameWnd.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #include "CFrameWnd.h"
  2. #pragma region 事件逻辑处理
  3. LRESULT CFrameWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  4. {
  5. switch (wParam)
  6. {
  7. case Timer_Banner_ID:
  8. SetTimerBannerSwitch();
  9. break;
  10. case Timer_Installing_ID:
  11. SetTimerInstalling();
  12. break;
  13. case Timer_WaitForNetwork_ID:
  14. SetTimerBanner();
  15. break;
  16. case Timer_SilentInstall_ID:
  17. SetTimerSilen();
  18. break;
  19. default:
  20. break;
  21. }
  22. bHandled = false;
  23. return 0;
  24. }
  25. void CFrameWnd::KillAllTimer()
  26. {
  27. KillTimer(m_hWnd, Timer_Banner_ID);
  28. KillTimer(m_hWnd, Timer_Installing_ID);
  29. KillTimer(m_hWnd, Timer_WaitForNetwork_ID);
  30. KillTimer(m_hWnd, Timer_SilentInstall_ID);
  31. }
  32. void CFrameWnd::StartTimer(UINT_PTR ID)
  33. {
  34. switch (ID)
  35. {
  36. case Timer_WaitForNetwork_ID:
  37. SetTimer(m_hWnd, Timer_WaitForNetwork_ID, Timer_WaitForNetwork_times, NULL);
  38. break;
  39. case Timer_Installing_ID:
  40. SetTimer(m_hWnd, Timer_Installing_ID, Timer_Installing_times, NULL);
  41. break;
  42. case Timer_Banner_ID:
  43. SetTimer(m_hWnd, Timer_Banner_ID, Timer_Banner_Times, NULL);
  44. break;
  45. case Timer_SilentInstall_ID:
  46. KillTimer(m_hWnd, Timer_WaitForNetwork_ID);
  47. KillTimer(m_hWnd, Timer_Installing_ID);
  48. SetTimer(m_hWnd, Timer_SilentInstall_ID, Timer_SilentInstall_Times, NULL);
  49. break;
  50. default:
  51. break;
  52. }
  53. }
  54. #pragma endregion
  55. void CFrameWnd::SlotMsg(TNotifyUI& msg)
  56. {
  57. if (msg.sType == DUI_MSGTYPE_CLICK)
  58. {
  59. if (msg.pSender->GetName() == _T("BtnClose"))
  60. {
  61. if (m_State.m_LayoutType == LayoutType::Home)
  62. {
  63. if (MSGID_OK == MessageBoxWnd::Show(m_hWnd, MessageContentType::IsExitApp))
  64. {
  65. ::DestroyWindow(m_hWnd);
  66. }
  67. }
  68. else
  69. {
  70. if (MSGID_OK == MessageBoxWnd::Show(m_hWnd, MessageContentType::InstalledIsExitApp))
  71. {
  72. ::DestroyWindow(m_hWnd);
  73. }
  74. }
  75. }
  76. if (msg.pSender->GetName() == _T("Btnminsize"))
  77. {
  78. SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
  79. }
  80. }
  81. }
  82. LRESULT CFrameWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  83. {
  84. LRESULT lRes = 0;
  85. //关闭窗口标识:任务栏右键菜单-》关闭窗口
  86. if (wParam == 61536)
  87. {
  88. //正在安装时,并且在联网的情况下,不允许退出程序窗口
  89. if (this->m_State.m_LayoutType == LayoutType::Installing && NetWorkState::IsNetWorking())
  90. return lRes;
  91. }
  92. lRes = CWindowWnd::HandleMessage(uMsg, wParam, lParam);
  93. return lRes;
  94. }
  95. void CFrameWnd::SelectLayout(LayoutType LayoutType)
  96. {
  97. this->m_State.m_LayoutType = LayoutType;
  98. m_InstallationPage->LayoutHome->SetVisible(false);
  99. m_InstallingPage->LayoutInstalling->SetVisible(false);
  100. m_InstalledPage->LayoutInstalled->SetVisible(false);
  101. switch (LayoutType)
  102. {
  103. case LayoutType::Home:
  104. IsNeedReStartSystem = false;
  105. m_InstallationPage->LayoutHome->SetVisible(true);
  106. m_InstallationPage->BtnClose->SetVisible(true);
  107. break;
  108. case LayoutType::Installing:
  109. m_InstallingPage->LayoutInstalling->SetVisible(true);
  110. m_InstallationPage->BtnClose->SetVisible(false);
  111. break;
  112. case LayoutType::Installed:
  113. m_InstalledPage->LayoutInstalled->SetVisible(true);
  114. m_InstallationPage->BtnClose->SetVisible(true);
  115. KillAllTimer();
  116. break;
  117. default:
  118. break;
  119. }
  120. }