CFrameWnd.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #pragma once
  2. //核心
  3. #include "CDownLoadFile.h"
  4. #include "CCmd.h"
  5. //字符与通用
  6. #include "CLanguage.h"
  7. #include "CClasses.h"
  8. #include "DefineStr.h"
  9. //系统与资源
  10. #include <WinInet.h>//网络
  11. #include <thread>
  12. #include "resource.h"
  13. //UI
  14. #include "CMsgWnd.h"
  15. //#include "CAdsBanner.h"
  16. #include "InstallPage.h"
  17. #include "InstallingPage.h"
  18. #include "InstalledPage.h"
  19. #include "MessageBoxWnd.h"
  20. #include "CMainPage.h"
  21. #include "stdafx.h"
  22. //#include "duilib.h"
  23. #include "KeyVar.h"
  24. #include "FileCore.h"
  25. #include "ComparVersion.h"
  26. #include "CharConvert.h"
  27. class CFrameWnd : public WindowImplBase
  28. {
  29. #pragma region 全局
  30. private:
  31. CDuiString m_strXMLPath;
  32. ThreadData m_threadData;
  33. CurrentState m_State;
  34. static SilenceInstallingType m_SilenceInstallingType;
  35. int CurrentDPI = 96;
  36. double dpi = 1;
  37. RECT start_rect_;
  38. CMainPage m_MainPage;
  39. bool IsNeedReStartSystem = false;//是否需要重启系统(win8 Net安装之后需要重启)
  40. public:
  41. //初始化
  42. explicit CFrameWnd(LPCTSTR pszXMLPath);
  43. CFrameWnd();
  44. ~CFrameWnd(void);
  45. virtual LPCTSTR GetWindowClassName() const;
  46. virtual CDuiString GetSkinFile() { return XML_MainFile; }
  47. virtual CDuiString GetSkinFolder();
  48. void InitControls();
  49. void InitWindow();
  50. void InitAsscessKey();
  51. void KillAllTimer();
  52. void StartTimer(UINT_PTR ID);
  53. private:
  54. void CustomInstallWndSize(bool isExpend);
  55. //逻辑
  56. void setDPI(int DPI);
  57. void AdaptationDPI();
  58. void SelectLayout(LayoutType LayoutType);
  59. void SlotMsg(TNotifyUI& msg);
  60. void LayoutNotify(TNotifyUI& msg);
  61. //消息事件
  62. void Notify(TNotifyUI& msg);
  63. // LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  64. LRESULT OnDPIChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  65. LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  66. LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  67. bool isclose = false;
  68. LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  69. LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  70. #pragma endregion
  71. #pragma region Banner事件和变量
  72. private:
  73. CAdsBanner* banner;
  74. int currentImageNum = 0;
  75. public:
  76. void GetBanner();
  77. void CreateBannerUI(CDuiString ImagePath, int i);
  78. void SetTimerBanner();
  79. void SetTimerBannerSwitch();
  80. void WaitForNetwork();
  81. static void Thread_LoadedBanner( ThreadData threadData);
  82. #pragma endregion
  83. #pragma region 安装主页
  84. public:
  85. bool m_isCanInstall = false;//有没有满足条件安装
  86. private:
  87. InstallationPage* m_InstallationPage;
  88. bool ischeckCustom = false;
  89. //初始化
  90. void InitHomeControls();
  91. //逻辑
  92. bool GetVersionState();
  93. void SetSelectedFolder();
  94. void GoToLink(std::wstring linkStr);
  95. void Install_Click();
  96. static void Thread_GetVerstion(ThreadData threadData);
  97. //消息事件
  98. void NotifyHome(TNotifyUI& msg);
  99. LRESULT HomeMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  100. #pragma endregion
  101. #pragma region 安装中
  102. private:
  103. InstallingPage* m_InstallingPage;
  104. void InitInstallingControls();
  105. void SetTimerInstalling();
  106. void SetTimerSilen();
  107. static void Thread_Installing(ThreadData threadData);
  108. //消息事件
  109. void NotifyInstalling(TNotifyUI& msg);
  110. LRESULT InstallingMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  111. #pragma endregion
  112. #pragma region 安装完成
  113. private:
  114. InstalledPage* m_InstalledPage;
  115. void InitInstalledControls();
  116. void ReStartSystem();
  117. void OpenApp_Click();
  118. static void Thread_OpenApp(ThreadData threadData);
  119. //消息事件
  120. void NotifyInstalled(TNotifyUI& msg);
  121. LRESULT InstalledMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  122. #pragma endregion
  123. };