From 6925c63bfa827e19ad276d4340c4a8de251519b9 Mon Sep 17 00:00:00 2001 From: liziyu0714 Date: Mon, 29 Jul 2024 02:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=A1=8C=E9=9D=A2;=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E4=BD=9C=E4=B8=BA=E5=90=AF=E5=8A=A8=E9=A1=B9?= =?UTF-8?q?=E7=9A=84=E9=9D=99=E9=BB=98=E5=90=AF=E5=8A=A8=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E6=96=B9=E5=BC=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/FDNRBox/DesktopManager.cs | 12 +++++++++--- src/FishDeskNextReborn/App.xaml.cs | 1 - src/FishDeskNextReborn/MainWindow.xaml.cs | 1 + src/FishDeskNextReborn/Register.cs | 2 ++ src/FishDeskNextReborn/window/DeployWindow.xaml.cs | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/FDNRBox/DesktopManager.cs b/src/FDNRBox/DesktopManager.cs index 8e3f88d..b5e5d6a 100644 --- a/src/FDNRBox/DesktopManager.cs +++ b/src/FDNRBox/DesktopManager.cs @@ -11,6 +11,8 @@ public static class DesktopManager public static int NowDesktop = 0; + public static bool Inited = false; + public static WindowsDesktop? GetInputDesktop() { WindowsDesktop windowsDesktop; @@ -33,11 +35,15 @@ public static void RefreshDesktops() public static void InitDesktops(List DesktopNames) { - RefreshDesktops(); - foreach (string desktopName in DesktopNames) + if(!Inited) { - InitNormalDesktop(desktopName); + RefreshDesktops(); + foreach (string desktopName in DesktopNames) + { + InitNormalDesktop(desktopName); + } } + } public static void DestroyDesktops() diff --git a/src/FishDeskNextReborn/App.xaml.cs b/src/FishDeskNextReborn/App.xaml.cs index d21934d..0bf3535 100644 --- a/src/FishDeskNextReborn/App.xaml.cs +++ b/src/FishDeskNextReborn/App.xaml.cs @@ -25,7 +25,6 @@ private void Application_Startup(object sender, StartupEventArgs e) else { mutexHelper.CreateMutex(); - DesktopManager.InitDesktops(["FDNR1","FDNR2","FDNR3","FDNR4","FDNR5"]); } } private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) diff --git a/src/FishDeskNextReborn/MainWindow.xaml.cs b/src/FishDeskNextReborn/MainWindow.xaml.cs index f52bd92..9d38d82 100644 --- a/src/FishDeskNextReborn/MainWindow.xaml.cs +++ b/src/FishDeskNextReborn/MainWindow.xaml.cs @@ -106,6 +106,7 @@ public void ChangeToggleMode() if (togglemode == ToggleDesktopMode.TaskView) { togglemode = ToggleDesktopMode.Win32; + DesktopManager.InitDesktops(["FDNR1", "FDNR2", "FDNR3", "FDNR4", "FDNR5"]); Growl.InfoGlobal("已切换到Win32模式"); } diff --git a/src/FishDeskNextReborn/Register.cs b/src/FishDeskNextReborn/Register.cs index af125c4..159c5b5 100644 --- a/src/FishDeskNextReborn/Register.cs +++ b/src/FishDeskNextReborn/Register.cs @@ -13,6 +13,7 @@ public static void RegistAll() private static void RegistMessage() { broadcastHelper.Regist("Show window", (sender) => { sender.Visibility = System.Windows.Visibility.Visible; return 0; }); + broadcastHelper.Regist("Hide window", (sender) => { sender.Visibility = System.Windows.Visibility.Hidden; return 0; }); broadcastHelper.Regist("Previous Desktop", (sender) => { sender.PreviousDesktop(); return 0; }); broadcastHelper.Regist("Next Desktop", (sender) => { sender.NextDesktop(); return 0; }); broadcastHelper.Regist("Open Deploy", (sender) => { sender.deployWindow.ShowDialog(); return 0; }); @@ -28,6 +29,7 @@ private static void RegistArgs() argResolver.Register("-S", () => { broadcastHelper.Broadcast("Show window"); }); argResolver.Register("-T", () => { broadcastHelper.Broadcast("Toggle Mode"); }); argResolver.Register("--OpenDesktopMgmt", () => { }); + argResolver.Register("--Silent", () => { broadcastHelper.Broadcast("Hide window"); }); } } } diff --git a/src/FishDeskNextReborn/window/DeployWindow.xaml.cs b/src/FishDeskNextReborn/window/DeployWindow.xaml.cs index 2609ef5..cb60b70 100644 --- a/src/FishDeskNextReborn/window/DeployWindow.xaml.cs +++ b/src/FishDeskNextReborn/window/DeployWindow.xaml.cs @@ -70,6 +70,7 @@ private void GenerateLinkBtn_Click(object sender, RoutedEventArgs e) CreateShortcut(path.DirectoryName!, "FDNR Previous", path.FullName, "Go to previous desktop", path.FullName, "-P"); CreateShortcut(path.DirectoryName!, "FDNR Deploy", path.FullName, "Open FDNR Deploy Tool", path.FullName, "-D"); CreateShortcut(path.DirectoryName!, "FDNR Config", path.FullName, "Open FDNR Config", path.FullName, ""); + CreateShortcut(path.DirectoryName!, "FDNR Silent Start", path.FullName, "Startup FDNR without window", path.FullName, "--Silent"); Growl.Info("部署快捷方式完成"); } }