Minimize to tray at startup

This commit is contained in:
Natsumi
2022-10-06 02:41:17 +13:00
parent 1e07903b54
commit c6a180fc7a
4 changed files with 20 additions and 8 deletions
+1 -2
View File
@@ -94,9 +94,8 @@ namespace VRCX
{
Thread.Sleep(1000);
}
catch
catch(ThreadInterruptedException)
{
// ThreadInterruptedException
}
}
}
+10 -2
View File
@@ -103,7 +103,15 @@ namespace VRCX
{
state = FormWindowState.Minimized;
}
WindowState = state;
if ("true".Equals(VRCXStorage.Instance.Get("VRCX_StartAsMinimizedState")) &&
"true".Equals(VRCXStorage.Instance.Get("VRCX_CloseToTray")))
{
BeginInvoke(new MethodInvoker(Hide));
}
else
{
WindowState = state;
}
}
catch
{
@@ -136,7 +144,7 @@ namespace VRCX
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing &&
"true".Equals(SharedVariable.Instance.Get("config:vrcx_closetotray")))
"true".Equals(VRCXStorage.Instance.Get("VRCX_CloseToTray")))
{
e.Cancel = true;
Hide();
+1 -2
View File
@@ -148,9 +148,8 @@ namespace VRCX
{
Thread.Sleep(32);
}
catch
catch(ThreadInterruptedException)
{
// ThreadInterruptedException
}
if (_active)
+8 -2
View File
@@ -12335,7 +12335,13 @@ speechSynthesis.getVoices();
);
$app.data.isStartAsMinimizedState =
VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true';
$app.data.isCloseToTray = configRepository.getBool('VRCX_CloseToTray');
$app.data.isCloseToTray = VRCXStorage.Get('VRCX_CloseToTray') === 'true';
if (configRepository.getBool('VRCX_CloseToTray')) {
// move back to JSON
$app.data.isCloseToTray = configRepository.getBool('VRCX_CloseToTray');
VRCXStorage.Set('VRCX_CloseToTray', $app.data.isCloseToTray.toString());
configRepository.remove('VRCX_CloseToTray');
}
var saveVRCXWindowOption = function () {
configRepository.setBool(
'VRCX_StartAtWindowsStartup',
@@ -12345,7 +12351,7 @@ speechSynthesis.getVoices();
'VRCX_StartAsMinimizedState',
this.isStartAsMinimizedState.toString()
);
configRepository.setBool('VRCX_CloseToTray', this.isCloseToTray);
VRCXStorage.Set('VRCX_CloseToTray', this.isCloseToTray.toString());
AppApi.SetStartup(this.isStartAtWindowsStartup);
};
$app.watch.isStartAtWindowsStartup = saveVRCXWindowOption;