VPet/VPet.Solution/App.xaml.cs

42 lines
1.2 KiB
C#
Raw Normal View History

2023-12-18 14:53:56 +00:00
using System.Diagnostics;
2023-09-11 08:01:44 +00:00
using System.Windows;
2023-12-18 14:53:56 +00:00
namespace VPet.Solution;
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
2023-09-11 08:01:44 +00:00
{
2023-12-18 14:53:56 +00:00
protected override void OnStartup(StartupEventArgs e)
2023-09-11 08:01:44 +00:00
{
2023-12-18 14:53:56 +00:00
if (e.Args != null && e.Args.Count() > 0)
2023-09-12 04:51:23 +00:00
{
2023-12-18 14:53:56 +00:00
switch (e.Args[0].ToLower())
2023-09-12 04:51:23 +00:00
{
2023-12-18 14:53:56 +00:00
case "removestarup":
var path =
Environment.GetFolderPath(Environment.SpecialFolder.Startup)
+ @"\VPET_Simulator.lnk";
if (File.Exists(path))
{
File.Delete(path);
}
2024-03-09 11:37:51 +00:00
break;
2023-12-18 14:53:56 +00:00
case "launchsteam":
2024-03-09 18:06:34 +00:00
var psi = new ProcessStartInfo
{
FileName = "cmd",
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = "/c start steam://rungameid/1920960"
};
Process.Start(psi);
2024-03-09 11:37:51 +00:00
break;
2023-09-12 04:51:23 +00:00
}
2024-03-09 11:37:51 +00:00
Application.Current.Shutdown();
2023-09-12 04:51:23 +00:00
}
2023-09-11 08:01:44 +00:00
}
}