mirror of
https://github.com/modernw/AppInstallerForWin8.git
synced 2026-04-11 16:57:18 +10:00
(None)
This commit is contained in:
@@ -114,8 +114,8 @@ IDR_MANIFEST1 RT_MANIFEST "res/manifest.xml"
|
|||||||
//
|
//
|
||||||
|
|
||||||
IDR_VERSION_ZH_CN VERSIONINFO
|
IDR_VERSION_ZH_CN VERSIONINFO
|
||||||
FILEVERSION 1,0,1,9
|
FILEVERSION 1,0,1,10
|
||||||
PRODUCTVERSION 1,0,1,9
|
PRODUCTVERSION 1,0,1,10
|
||||||
FILEFLAGSMASK 0x0L
|
FILEFLAGSMASK 0x0L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -132,9 +132,9 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Bruce Winter"
|
VALUE "CompanyName", "Bruce Winter"
|
||||||
VALUE "FileDescription", "应用安装程序"
|
VALUE "FileDescription", "应用安装程序"
|
||||||
VALUE "FileVersion", "1.0.1.9"
|
VALUE "FileVersion", "1.0.1.10"
|
||||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||||
VALUE "ProductVersion", "1.0.1.9"
|
VALUE "ProductVersion", "1.0.1.10"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
@@ -144,8 +144,8 @@ BEGIN
|
|||||||
END
|
END
|
||||||
|
|
||||||
IDR_VERSION_EN_US VERSIONINFO
|
IDR_VERSION_EN_US VERSIONINFO
|
||||||
FILEVERSION 1,0,1,9
|
FILEVERSION 1,0,1,10
|
||||||
PRODUCTVERSION 1,0,1,9
|
PRODUCTVERSION 1,0,1,10
|
||||||
FILEFLAGSMASK 0x0L
|
FILEFLAGSMASK 0x0L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -162,9 +162,9 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Bruce Winter"
|
VALUE "CompanyName", "Bruce Winter"
|
||||||
VALUE "FileDescription", "App Installer"
|
VALUE "FileDescription", "App Installer"
|
||||||
VALUE "FileVersion", "1.0.1.9"
|
VALUE "FileVersion", "1.0.1.10"
|
||||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||||
VALUE "ProductVersion", "1.0.1.9"
|
VALUE "ProductVersion", "1.0.1.10"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -1,17 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||||
<application>
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<!-- Windows 10 -->
|
<application>
|
||||||
|
<!-- Windows 10 -->
|
||||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
<!-- Windows 8.1 -->
|
<!-- Windows 8.1 -->
|
||||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
<!-- Windows Vista -->
|
<!-- Windows Vista -->
|
||||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
<!-- Windows 7 -->
|
<!-- Windows 7 -->
|
||||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
<!-- Windows 8 -->
|
<!-- Windows 8 -->
|
||||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a4e38}"/>
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
|
|
||||||
|
<!-- 高DPI感知配置(兼容旧版SDK) -->
|
||||||
|
<asmv3:application>
|
||||||
|
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
|
||||||
|
</asmv3:windowsSettings>
|
||||||
|
</asmv3:application>
|
||||||
|
|
||||||
</assembly>
|
</assembly>
|
||||||
@@ -29,6 +29,7 @@ using namespace System;
|
|||||||
using namespace System::Windows::Forms;
|
using namespace System::Windows::Forms;
|
||||||
using namespace System::Threading;
|
using namespace System::Threading;
|
||||||
using namespace msclr::interop;
|
using namespace msclr::interop;
|
||||||
|
using namespace System::Runtime::InteropServices;
|
||||||
|
|
||||||
int GetScreenWidth ()
|
int GetScreenWidth ()
|
||||||
{
|
{
|
||||||
@@ -44,6 +45,9 @@ int GetScreenHeight ()
|
|||||||
#define toBool(_String_Managed_Object_) Boolean::Parse (_String_Managed_Object_)
|
#define toBool(_String_Managed_Object_) Boolean::Parse (_String_Managed_Object_)
|
||||||
#define toDateTime(_String_Managed_Object_) DateTime::Parse (_String_Managed_Object_)
|
#define toDateTime(_String_Managed_Object_) DateTime::Parse (_String_Managed_Object_)
|
||||||
|
|
||||||
|
extern int iDpi = GetDPI ();
|
||||||
|
extern double dDpi = iDpi * 0.01;
|
||||||
|
|
||||||
String ^GetRCString_NET (UINT resID)
|
String ^GetRCString_NET (UINT resID)
|
||||||
{
|
{
|
||||||
size_t bufferSize = 256;
|
size_t bufferSize = 256;
|
||||||
@@ -206,9 +210,6 @@ void SetWebBrowserEmulation ()
|
|||||||
System::Runtime::InteropServices::Marshal::FreeHGlobal (appNamePtr);
|
System::Runtime::InteropServices::Marshal::FreeHGlobal (appNamePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
bool IsIeVersion10 ()
|
bool IsIeVersion10 ()
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
@@ -335,44 +336,27 @@ void OutputDebugStringFormatted (const wchar_t* format, ...);
|
|||||||
public ref class AppWindow: public Form
|
public ref class AppWindow: public Form
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WebBrowser ^webUI;
|
System::Windows::Forms::WebBrowser ^webUI;
|
||||||
std::vector <appmap> *appItems = new std::vector <appmap> ();
|
std::vector <appmap> *appItems = new std::vector <appmap> ();
|
||||||
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
||||||
public:
|
public:
|
||||||
AppWindow ()
|
AppWindow ()
|
||||||
{
|
{
|
||||||
this->Visible = false;
|
this->Visible = false;
|
||||||
BOOL transitionsEnabled = FALSE;
|
this->DoubleBuffered = true;
|
||||||
HRESULT hr = DwmSetWindowAttribute (
|
|
||||||
reinterpret_cast <HWND> (this->Handle.ToPointer ()),
|
|
||||||
DWMWA_TRANSITIONS_FORCEDISABLED,
|
|
||||||
&transitionsEnabled,
|
|
||||||
sizeof (transitionsEnabled)
|
|
||||||
);
|
|
||||||
DWMNCRENDERINGPOLICY dwmplc = DWMNCRP_ENABLED;
|
|
||||||
hr = DwmSetWindowAttribute (
|
|
||||||
reinterpret_cast <HWND> (this->Handle.ToPointer ()),
|
|
||||||
DWMWA_NCRENDERING_POLICY,
|
|
||||||
&dwmplc,
|
|
||||||
sizeof (dwmplc)
|
|
||||||
);
|
|
||||||
MARGINS margins = {-1, -1, -1, -1};
|
|
||||||
hr = DwmExtendFrameIntoClientArea (
|
|
||||||
reinterpret_cast <HWND> (this->Handle.ToPointer ()),
|
|
||||||
&margins
|
|
||||||
);
|
|
||||||
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
||||||
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
|
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
|
||||||
this->ShowInTaskbar = false;
|
this->ShowInTaskbar = false;
|
||||||
this->TopMost = true;
|
this->TopMost = true;
|
||||||
this->Size = System::Drawing::Size (392, 494);
|
this->Size = System::Drawing::Size (392 * dDpi, 494 * dDpi);
|
||||||
if (IsWindows10AndLater ()) this->MinimumSize = System::Drawing::Size (392, 226);
|
if (IsWindows10AndLater ()) this->MinimumSize = System::Drawing::Size (392 * dDpi, 226 * dDpi);
|
||||||
else this->MinimumSize = System::Drawing::Size (392, 129);
|
else this->MinimumSize = System::Drawing::Size (392 * dDpi, 129 * dDpi);
|
||||||
if (IsWindows10AndLater ()) this->MaximumSize = System::Drawing::Size (392, 522);
|
if (IsWindows10AndLater ()) this->MaximumSize = System::Drawing::Size (392 * dDpi, 522 * dDpi);
|
||||||
else this->MaximumSize = System::Drawing::Size (368, 394);
|
else this->MaximumSize = System::Drawing::Size (368 * dDpi, 394 * dDpi);
|
||||||
this->Text = rcString (APPLIST_WINTITLE);
|
this->Text = rcString (APPLIST_WINTITLE);
|
||||||
webUI = gcnew WebBrowser ();
|
webUI = gcnew System::Windows::Forms::WebBrowser ();
|
||||||
webUI->Dock = DockStyle::Fill;
|
webUI->Dock = DockStyle::Fill;
|
||||||
|
webUI->Visible = false;
|
||||||
this->Controls->Add (webUI);
|
this->Controls->Add (webUI);
|
||||||
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
||||||
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Libs\\AppList.html");
|
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Libs\\AppList.html");
|
||||||
@@ -387,6 +371,7 @@ public ref class AppWindow: public Form
|
|||||||
}
|
}
|
||||||
void OnDocumentCompleted (Object ^sender, WebBrowserDocumentCompletedEventArgs ^e)
|
void OnDocumentCompleted (Object ^sender, WebBrowserDocumentCompletedEventArgs ^e)
|
||||||
{
|
{
|
||||||
|
this->CallJSFunction ("SetHighDpiMode", gcnew array <Object ^> { 2 });
|
||||||
CallJSFunction ("SetText", gcnew array <Object ^> {
|
CallJSFunction ("SetText", gcnew array <Object ^> {
|
||||||
"span-title",
|
"span-title",
|
||||||
rcString (APPLIST_TITLE)
|
rcString (APPLIST_TITLE)
|
||||||
@@ -397,9 +382,10 @@ public ref class AppWindow: public Form
|
|||||||
});
|
});
|
||||||
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &AppWindow::InvokeRefreshAppItems));
|
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &AppWindow::InvokeRefreshAppItems));
|
||||||
thread->Start ();
|
thread->Start ();
|
||||||
|
webUI->Visible = true; // **加载完成后显示 webUI**
|
||||||
this->Visible = true;
|
this->Visible = true;
|
||||||
}
|
}
|
||||||
void SendAppData (std::vector<appmap> apps)
|
void SendAppData (std::vector <appmap> apps)
|
||||||
{
|
{
|
||||||
if (appItems) delete appItems;
|
if (appItems) delete appItems;
|
||||||
appItems = nullptr;
|
appItems = nullptr;
|
||||||
@@ -412,9 +398,21 @@ public ref class AppWindow: public Form
|
|||||||
}
|
}
|
||||||
void eventLaunchApp (String ^appModelUserId)
|
void eventLaunchApp (String ^appModelUserId)
|
||||||
{
|
{
|
||||||
|
taskLaunchApp (appModelUserId);
|
||||||
|
}
|
||||||
|
void taskLaunchApp (Object ^parameter)
|
||||||
|
{
|
||||||
|
String^ aMUId = safe_cast <String ^> (parameter);
|
||||||
DWORD dwPId = 0;
|
DWORD dwPId = 0;
|
||||||
LaunchApp ((marshal_as <std::wstring> (appModelUserId)).c_str (), &dwPId);
|
LaunchApp ((marshal_as <std::wstring> (aMUId)).c_str (), &dwPId);
|
||||||
this->Close ();
|
if (this->InvokeRequired)
|
||||||
|
{
|
||||||
|
if (this->IsHandleCreated) this->Invoke (gcnew Action (this, &AppWindow::Close));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this->IsHandleCreated) this->Close ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void eventCancelWindow ()
|
void eventCancelWindow ()
|
||||||
{
|
{
|
||||||
@@ -461,9 +459,9 @@ public ref class AppWindow: public Form
|
|||||||
{
|
{
|
||||||
CallJSFunction ("ClearListItems", gcnew array <Object ^> { });
|
CallJSFunction ("ClearListItems", gcnew array <Object ^> { });
|
||||||
bool isWin10 = IsWindows10AndLater ();
|
bool isWin10 = IsWindows10AndLater ();
|
||||||
size_t height = ((appItems->size ()) * (isWin10 ? 50 : 60)) + (isWin10 ? 206 : 120);
|
size_t height = ((appItems->size ()) * (isWin10 ? 50 : 60) * dDpi) + (isWin10 ? 206 : 120) * dDpi;
|
||||||
if (height < (isWin10 ? 522 : 394)) this->Height = height;
|
if (height < (isWin10 ? 522 : 394) * dDpi) this->Height = height;
|
||||||
else this->Height = 522;
|
else this->Height = 522 * dDpi;
|
||||||
this->Left = (GetScreenWidth () - this->Width) / 2;
|
this->Left = (GetScreenWidth () - this->Width) / 2;
|
||||||
this->Top = (GetScreenHeight () - this->Height) / 2;
|
this->Top = (GetScreenHeight () - this->Height) / 2;
|
||||||
for (auto it : *appItems)
|
for (auto it : *appItems)
|
||||||
@@ -478,30 +476,44 @@ public ref class AppWindow: public Form
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
virtual void OnHandleCreated (EventArgs^ e) override
|
||||||
|
{
|
||||||
|
Form::OnHandleCreated (e);
|
||||||
|
if (Environment::OSVersion->Version->Major >= 6)
|
||||||
|
{
|
||||||
|
MARGINS margins = {0, 0, 0, 0};
|
||||||
|
HRESULT hr = DwmExtendFrameIntoClientArea ((HWND)this->Handle.ToPointer (), &margins);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ref class MainWnd: public Form
|
public ref class MainWnd: public Form
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WebBrowser ^webUI;
|
System::Windows::Forms::WebBrowser ^webUI;
|
||||||
int page;
|
int page;
|
||||||
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
||||||
|
System::Windows::Forms::Timer^ fadeTimer;
|
||||||
public:
|
public:
|
||||||
MainWnd (): page (-1)
|
MainWnd (): page (-1)
|
||||||
{
|
{
|
||||||
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
||||||
|
this->Opacity = 0.0;
|
||||||
initWnd ();
|
initWnd ();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void initWnd ()
|
void initWnd ()
|
||||||
{
|
{
|
||||||
this->Visible = false;
|
this->Visible = false;
|
||||||
this->webUI = gcnew WebBrowser ();
|
this->DoubleBuffered = true;
|
||||||
|
this->BackColor = System::Drawing::Color::FromArgb (0, 120, 215);
|
||||||
|
SetWebBrowserEmulation ();
|
||||||
|
this->webUI = gcnew System::Windows::Forms::WebBrowser ();
|
||||||
|
this->webUI->BackColor = this->BackColor;
|
||||||
this->SuspendLayout ();
|
this->SuspendLayout ();
|
||||||
this->webUI->Dock = DockStyle::Fill;
|
this->webUI->Dock = DockStyle::Fill;
|
||||||
this->webUI->DocumentCompleted += gcnew WebBrowserDocumentCompletedEventHandler (this, &MainWnd::eventOnDocumentCompleted);
|
|
||||||
this->webUI->IsWebBrowserContextMenuEnabled = false;
|
this->webUI->IsWebBrowserContextMenuEnabled = false;
|
||||||
this->webUI->PreviewKeyDown += gcnew System::Windows::Forms::PreviewKeyDownEventHandler (this, &MainWnd::eventOnPreviewKeyDown_WebBrowser);
|
|
||||||
this->Controls->Add (this->webUI);
|
this->Controls->Add (this->webUI);
|
||||||
HICON tempIco = LoadRCIcon (ICON_TASKBAR);
|
HICON tempIco = LoadRCIcon (ICON_TASKBAR);
|
||||||
if (tempIco)
|
if (tempIco)
|
||||||
@@ -537,21 +549,22 @@ public ref class MainWnd: public Form
|
|||||||
m_initConfig.readUIntValue (L"Settings", L"MinPosHeight", (unsigned)_wtol (GetRCString_cpp (LIMITHEIGHT).c_str ()))
|
m_initConfig.readUIntValue (L"Settings", L"MinPosHeight", (unsigned)_wtol (GetRCString_cpp (LIMITHEIGHT).c_str ()))
|
||||||
);
|
);
|
||||||
this->WindowState = (System::Windows::Forms::FormWindowState)m_initConfig.readIntValue (L"Settings", L"WindowPos", (int)System::Windows::Forms::FormWindowState::Normal);
|
this->WindowState = (System::Windows::Forms::FormWindowState)m_initConfig.readIntValue (L"Settings", L"WindowPos", (int)System::Windows::Forms::FormWindowState::Normal);
|
||||||
this->ClientSize = System::Drawing::Size (wid, hei);
|
this->ClientSize = System::Drawing::Size (wid * dDpi, hei * dDpi);
|
||||||
this->Text = GetRCString (WIN_TITLE);
|
this->Text = GetRCString (WIN_TITLE);
|
||||||
|
this->ResumeLayout (false);
|
||||||
|
webUI->ObjectForScripting = this;
|
||||||
|
this->webUI->DocumentCompleted += gcnew WebBrowserDocumentCompletedEventHandler (this, &MainWnd::eventOnDocumentCompleted);
|
||||||
|
this->webUI->PreviewKeyDown += gcnew System::Windows::Forms::PreviewKeyDownEventHandler (this, &MainWnd::eventOnPreviewKeyDown_WebBrowser);
|
||||||
|
this->Resize += gcnew System::EventHandler (this, &MainWnd::eventOnResize);
|
||||||
this->Load += gcnew EventHandler (this, &MainWnd::eventOnCreate);
|
this->Load += gcnew EventHandler (this, &MainWnd::eventOnCreate);
|
||||||
this->ResizeEnd += gcnew EventHandler (this, &MainWnd::eventOnResizeEnd);
|
this->ResizeEnd += gcnew EventHandler (this, &MainWnd::eventOnResizeEnd);
|
||||||
this->ResumeLayout (false);
|
|
||||||
this->Resize += gcnew System::EventHandler (this, &MainWnd::eventOnResize);
|
|
||||||
}
|
}
|
||||||
void eventOnCreate (System::Object ^sender, System::EventArgs ^e)
|
void eventOnCreate (System::Object ^sender, System::EventArgs ^e)
|
||||||
{
|
{
|
||||||
SetWebBrowserEmulation ();
|
|
||||||
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
||||||
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Index.html");
|
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Index.html");
|
||||||
if (IsIeVersion10 ()) htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\IndexIE10.html"); // IE10 (Win8) 特供
|
if (IsIeVersion10 ()) htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\IndexIE10.html"); // IE10 (Win8) 特供
|
||||||
webUI->Navigate (htmlFilePath);
|
webUI->Navigate (htmlFilePath);
|
||||||
webUI->ObjectForScripting = this;
|
|
||||||
}
|
}
|
||||||
void eventOnPreviewKeyDown_WebBrowser (System::Object ^sender, System::Windows::Forms::PreviewKeyDownEventArgs ^e)
|
void eventOnPreviewKeyDown_WebBrowser (System::Object ^sender, System::Windows::Forms::PreviewKeyDownEventArgs ^e)
|
||||||
{
|
{
|
||||||
@@ -562,9 +575,25 @@ public ref class MainWnd: public Form
|
|||||||
{
|
{
|
||||||
if (e->Url->ToString () == webUI->Url->ToString ())
|
if (e->Url->ToString () == webUI->Url->ToString ())
|
||||||
{
|
{
|
||||||
eventOnPageLoad ();
|
this->CallJSFunction ("SetHighDpiMode", gcnew array <Object ^> { 2 });
|
||||||
|
this->CallJSFunction ("SetPageZoom", gcnew array <Object ^> { dDpi });
|
||||||
|
this->Visible = true;
|
||||||
|
fadeTimer = gcnew System::Windows::Forms::Timer ();
|
||||||
|
fadeTimer->Interval = 5;
|
||||||
|
fadeTimer->Tick += gcnew EventHandler (this, &MainWnd::fadeTimer_Tick);
|
||||||
|
fadeTimer->Start ();
|
||||||
|
this->setLaunchWhenReadyJS (m_initConfig.readBoolValue (L"Settings", L"LaunchWhenReady", true));
|
||||||
|
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskReadFile));
|
||||||
|
thread->Start ();
|
||||||
|
Thread ^thread2 = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountDarkMode));
|
||||||
|
thread2->Start ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void fadeTimer_Tick (Object^ sender, EventArgs^ e)
|
||||||
|
{
|
||||||
|
if (this->Opacity < 1.0) this->Opacity += 0.2;
|
||||||
|
else fadeTimer->Stop ();
|
||||||
|
}
|
||||||
void eventOnResizeEnd (Object ^sender, EventArgs ^e)
|
void eventOnResizeEnd (Object ^sender, EventArgs ^e)
|
||||||
{
|
{
|
||||||
if (this->WindowState == FormWindowState::Maximized)
|
if (this->WindowState == FormWindowState::Maximized)
|
||||||
@@ -576,7 +605,7 @@ public ref class MainWnd: public Form
|
|||||||
this->changeMaxDisplayPicJS (false);
|
this->changeMaxDisplayPicJS (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void eventOnResize (Object ^sender, EventArgs ^e)
|
void adjustWhenResize ()
|
||||||
{
|
{
|
||||||
if (this->WindowState == FormWindowState::Maximized)
|
if (this->WindowState == FormWindowState::Maximized)
|
||||||
{
|
{
|
||||||
@@ -589,22 +618,44 @@ public ref class MainWnd: public Form
|
|||||||
this->changeMaxDisplayPicJS (false);
|
this->changeMaxDisplayPicJS (false);
|
||||||
if (m_initConfig.readBoolValue (L"Settings", L"SavePosBeforeClosing"))
|
if (m_initConfig.readBoolValue (L"Settings", L"SavePosBeforeClosing"))
|
||||||
{
|
{
|
||||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", this->Width);
|
System::Drawing::Size ^client = this->ClientSize;
|
||||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", this->Height);
|
if (dDpi == 1)
|
||||||
|
{
|
||||||
|
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", client->Width);
|
||||||
|
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", client->Height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", client->Width / dDpi);
|
||||||
|
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", client->Height / dDpi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this->webUI->IsHandleCreated)
|
||||||
|
{
|
||||||
|
UINT resID = 0;
|
||||||
|
switch (page)
|
||||||
|
{
|
||||||
|
case 2: resID = PAGE_1_TITLE; break;
|
||||||
|
case 3: resID = PAGE_2_TITLE; break;
|
||||||
|
case 4: resID = PAGE_4_TITLE; break;
|
||||||
|
case 5: resID = PAGE_5_TITLE; break;
|
||||||
|
}
|
||||||
|
if (resID)
|
||||||
|
{
|
||||||
|
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||||
|
std::wstring temp = StrPrintFormatW (GetRCString_cpp (resID).c_str (), L" ");
|
||||||
|
std::wstring temp1 = temp + title;
|
||||||
|
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||||
|
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||||
|
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (resID).c_str (), sub.c_str ()).c_str ()));
|
||||||
|
// this->CallJSFunction ("adjustTextareaHeight", gcnew array <Object ^> {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void eventOnPageLoad ()
|
void eventOnResize (Object ^sender, EventArgs ^e)
|
||||||
{
|
{
|
||||||
this->Visible = true;
|
this->adjustWhenResize ();
|
||||||
this->setLaunchWhenReadyJS (m_initConfig.readBoolValue (L"Settings", L"LaunchWhenReady", true));
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if (IsIeVersion10 ()) hideFrameJS (false);
|
|
||||||
#endif
|
|
||||||
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskReadFile));
|
|
||||||
thread->Start ();
|
|
||||||
Thread ^thread2 = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountDarkMode));
|
|
||||||
thread2->Start ();
|
|
||||||
}
|
}
|
||||||
void eventOnPress_button1 ()
|
void eventOnPress_button1 ()
|
||||||
{
|
{
|
||||||
@@ -886,6 +937,21 @@ public ref class MainWnd: public Form
|
|||||||
setProgressTextJS (content);
|
setProgressTextJS (content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void adjustTextareaHeightJS ()
|
||||||
|
{
|
||||||
|
this->CallJSFunction ("adjustTextareaHeight", gcnew array <Object ^> {});
|
||||||
|
}
|
||||||
|
void invokeAdjustTextareaHeight ()
|
||||||
|
{
|
||||||
|
if (this->InvokeRequired)
|
||||||
|
{
|
||||||
|
this->Invoke (gcnew Action (this, &MainWnd::adjustTextareaHeightJS));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
adjustTextareaHeightJS ();
|
||||||
|
}
|
||||||
|
}
|
||||||
void setPage (int serial)
|
void setPage (int serial)
|
||||||
{
|
{
|
||||||
switch (serial)
|
switch (serial)
|
||||||
@@ -900,8 +966,10 @@ public ref class MainWnd: public Form
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), title.c_str ());
|
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), L" ");
|
||||||
|
std::wstring temp1 = temp + title;
|
||||||
|
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), sub.c_str ()).c_str ()));
|
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||||
}
|
}
|
||||||
@@ -978,16 +1046,20 @@ public ref class MainWnd: public Form
|
|||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
invokeSetProgressText (rcString (PAGE_2_LOADING));
|
invokeSetProgressText (rcString (PAGE_2_LOADING));
|
||||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), title.c_str ());
|
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), L" ");
|
||||||
|
std::wstring temp1 = temp + title;
|
||||||
|
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), sub.c_str ()).c_str ()));
|
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), title.c_str ());
|
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), L" ");
|
||||||
|
std::wstring temp1 = temp + title;
|
||||||
|
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), sub.c_str ()).c_str ()));
|
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||||
}
|
}
|
||||||
@@ -1007,8 +1079,10 @@ public ref class MainWnd: public Form
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), title.c_str ());
|
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), L" ");
|
||||||
|
std::wstring temp1 = temp + title;
|
||||||
|
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), sub.c_str ()).c_str ()));
|
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||||
if (GetLastErrorDetailTextLength ()) setTextJS ("caption-more-info", gcnew String (GetLastErrorDetailText ()));
|
if (GetLastErrorDetailTextLength ()) setTextJS ("caption-more-info", gcnew String (GetLastErrorDetailText ()));
|
||||||
@@ -1043,6 +1117,7 @@ public ref class MainWnd: public Form
|
|||||||
setPicBoxVisibilityJS (false);
|
setPicBoxVisibilityJS (false);
|
||||||
}
|
}
|
||||||
page = serial;
|
page = serial;
|
||||||
|
this->adjustWhenResize ();
|
||||||
}
|
}
|
||||||
void invokeSetPage (int page)
|
void invokeSetPage (int page)
|
||||||
{
|
{
|
||||||
@@ -1189,7 +1264,10 @@ public ref class MainWnd: public Form
|
|||||||
invokeSetPage (1);
|
invokeSetPage (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->IsHandleCreated) this->invokeSetDarkMode (IsAppInDarkMode ());
|
if (this->IsHandleCreated)
|
||||||
|
{
|
||||||
|
this->invokeSetDarkMode (IsAppInDarkMode ());
|
||||||
|
}
|
||||||
EmptyWorkingSet ((HANDLE)-1);
|
EmptyWorkingSet ((HANDLE)-1);
|
||||||
}
|
}
|
||||||
void taskInstallPackage ()
|
void taskInstallPackage ()
|
||||||
|
|||||||
Reference in New Issue
Block a user