#include "CFrameWnd.h" #pragma region 事件逻辑处理 LRESULT CFrameWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { switch (wParam) { case Timer_Banner_ID: SetTimerBannerSwitch(); break; case Timer_Installing_ID: SetTimerInstalling(); break; case Timer_WaitForNetwork_ID: SetTimerBanner(); break; case Timer_SilentInstall_ID: SetTimerSilen(); break; default: break; } bHandled = false; return 0; } void CFrameWnd::KillAllTimer() { KillTimer(m_hWnd, Timer_Banner_ID); KillTimer(m_hWnd, Timer_Installing_ID); KillTimer(m_hWnd, Timer_WaitForNetwork_ID); KillTimer(m_hWnd, Timer_SilentInstall_ID); } void CFrameWnd::StartTimer(UINT_PTR ID) { switch (ID) { case Timer_WaitForNetwork_ID: SetTimer(m_hWnd, Timer_WaitForNetwork_ID, Timer_WaitForNetwork_times, NULL); break; case Timer_Installing_ID: SetTimer(m_hWnd, Timer_Installing_ID, Timer_Installing_times, NULL); break; case Timer_Banner_ID: SetTimer(m_hWnd, Timer_Banner_ID, Timer_Banner_Times, NULL); break; case Timer_SilentInstall_ID: KillTimer(m_hWnd, Timer_WaitForNetwork_ID); KillTimer(m_hWnd, Timer_Installing_ID); SetTimer(m_hWnd, Timer_SilentInstall_ID, Timer_SilentInstall_Times, NULL); break; default: break; } } #pragma endregion void CFrameWnd::SlotMsg(TNotifyUI& msg) { if (msg.sType == DUI_MSGTYPE_CLICK) { if (msg.pSender->GetName() == _T("BtnClose")) { if (m_State.m_LayoutType == LayoutType::Home) { if (MSGID_OK == MessageBoxWnd::Show(m_hWnd, MessageContentType::IsExitApp)) { ::DestroyWindow(m_hWnd); } } else { if (MSGID_OK == MessageBoxWnd::Show(m_hWnd, MessageContentType::InstalledIsExitApp)) { ::DestroyWindow(m_hWnd); } } } if (msg.pSender->GetName() == _T("Btnminsize")) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } } } LRESULT CFrameWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LRESULT lRes = 0; //关闭窗口标识:任务栏右键菜单-》关闭窗口 if (wParam == 61536) { //正在安装时,并且在联网的情况下,不允许退出程序窗口 if (this->m_State.m_LayoutType == LayoutType::Installing && NetWorkState::IsNetWorking()) return lRes; } lRes = CWindowWnd::HandleMessage(uMsg, wParam, lParam); return lRes; } void CFrameWnd::SelectLayout(LayoutType LayoutType) { this->m_State.m_LayoutType = LayoutType; m_InstallationPage->LayoutHome->SetVisible(false); m_InstallingPage->LayoutInstalling->SetVisible(false); m_InstalledPage->LayoutInstalled->SetVisible(false); switch (LayoutType) { case LayoutType::Home: IsNeedReStartSystem = false; m_InstallationPage->LayoutHome->SetVisible(true); m_InstallationPage->BtnClose->SetVisible(true); break; case LayoutType::Installing: m_InstallingPage->LayoutInstalling->SetVisible(true); m_InstallationPage->BtnClose->SetVisible(false); break; case LayoutType::Installed: m_InstalledPage->LayoutInstalled->SetVisible(true); m_InstallationPage->BtnClose->SetVisible(true); KillAllTimer(); break; default: break; } }