//Command Line Args private async void Arguments() { string[] args = Environment.GetCommandLineArgs(); if (args.Contains("help")) { Hide(); Help(null, null); Close(); } if (args.Contains("update")) { Hide(); bool updateAvailable = await InstallerHelper.CheckForUpdates(this, true); if (updateAvailable) { Update(null, null); } else { Close(); } } if (args.Contains("troubleshooting")) { //Task.Delay for Open/Close Animations await Task.Delay(400); await ShowOkDialog(str.troubleshooting, str.troubleshootingTips); await Task.Delay(200); Close(); } }
//Save Changes Button private async void Save(object s, RoutedEventArgs e) { try { Cursor = Cursors.Wait; ConfigHelper.Save(); //Restart for applied changes InstallerHelper.KillPipeShot(false); //If not Tray Service, do not start if (ConfigHelper.RunOnBoot) { try { InstallerHelper.StartPipeShot(); } catch { await ErrorToast.ShowAsync(str.trayServiceNotRunning, TimeSpan.FromSeconds(3)); } } SuccessToast.Show(str.applied, TimeSpan.FromSeconds(2)); BtnSave.IsEnabled = false; } catch { ErrorToast.Show(str.couldNotApply, TimeSpan.FromSeconds(3)); } Cursor = Cursors.Arrow; }
//Constructor public MainWindow() { InitializeComponent(); //Update Loading Indicator ShowProgressIndicator(); SetProgressStatus(str.initializing); //Check for Commandline Arguments Arguments(); //Create Documents\PipeShot Path if (!Directory.Exists(DocPath)) { Directory.CreateDirectory(DocPath); } //Initialize Helpers Helper = new InstallerHelper(ErrorToast); }