From cfbc7c64bd966c02135a782f84659e125a65dc62 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Tue, 12 Sep 2023 12:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3=E5=B7=A5?= =?UTF-8?q?=E5=85=B7:=20=E5=88=A0=E9=99=A4=E5=BC=80=E6=9C=BA=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.Solution/App.xaml.cs | 20 ++++++++++++++++++++ VPet.Solution/MainWindow.xaml.cs | 5 +++++ VPet.Solution/VPet.Solution.csproj | 4 ---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/VPet.Solution/App.xaml.cs b/VPet.Solution/App.xaml.cs index 6348e7f..0985e19 100644 --- a/VPet.Solution/App.xaml.cs +++ b/VPet.Solution/App.xaml.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Configuration; using System.Data; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -13,5 +14,24 @@ namespace VPet.Solution /// public partial class App : Application { + public static bool IsDone { get; set; } = false; + protected override void OnStartup(StartupEventArgs e) + { + if (e.Args != null && e.Args.Count() > 0) + { + IsDone = true; + switch (e.Args[0].ToLower()) + { + case "removestarup": + var path = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + @"\VPET_Simulator.lnk"; + if(File.Exists(path)) + { + File.Delete(path); + } + return; + } + } + IsDone = false; + } } } diff --git a/VPet.Solution/MainWindow.xaml.cs b/VPet.Solution/MainWindow.xaml.cs index fbd1c19..f6d127e 100644 --- a/VPet.Solution/MainWindow.xaml.cs +++ b/VPet.Solution/MainWindow.xaml.cs @@ -22,6 +22,11 @@ namespace VPet.Solution { public MainWindow() { + if (App.IsDone) + { + Close(); + return; + } InitializeComponent(); } } diff --git a/VPet.Solution/VPet.Solution.csproj b/VPet.Solution/VPet.Solution.csproj index 700984a..daa478f 100644 --- a/VPet.Solution/VPet.Solution.csproj +++ b/VPet.Solution/VPet.Solution.csproj @@ -116,10 +116,6 @@ {dcad838a-1a02-4bdf-962c-fd47c6006d28} VPet-Simulator.Windows.Interface - - {b5c2dd17-735f-4f9f-82e4-b8692aec03f1} - VPet-Simulator.Windows - \ No newline at end of file