private async void Remove_Plugin(object sender, RoutedEventArgs e) { _progressBarDialog = new ProgressBarDialog(); _progressBarDialog.Owner = this; _progressBarDialog.Show(); _progressBarDialog.UpdateProgress(false, "Uninstalling SRS"); var result = await UninstallSR(srPath.Text, dcsScriptsPath.Text); if (result) { _progressBarDialog.UpdateProgress(true, "Removed SRS Successfully!"); Logger.Info($"Removed SRS Successfully!"); MessageBox.Show( "SR Standalone Removed Successfully!\n\nContaining folder left just in case you want favourites or frequencies", "SR Standalone Installer", MessageBoxButton.OK, MessageBoxImage.Information); } else { _progressBarDialog.UpdateProgress(true, "Error with Uninstaller"); MessageBox.Show( "Error with uninstaller - please post your installer-log.txt on the SRS Discord for Support", "Installation Error", MessageBoxButton.OK, MessageBoxImage.Error); Process.Start("https://discord.gg/vqxAw7H"); Process.Start("explorer.exe", GetWorkingDirectory()); } Environment.Exit(0); }
private async void InstallReleaseButton(object sender, RoutedEventArgs e) { InstallButton.IsEnabled = false; RemoveButton.IsEnabled = false; InstallButton.Content = "Installing..."; _progressBarDialog = new ProgressBarDialog(); _progressBarDialog.Owner = this; _progressBarDialog.Show(); var srsPath = srPath.Text; var dcScriptsPath = dcsScriptsPath.Text; var shortcut = CreateStartMenuShortcut.IsChecked ?? true; if ((bool)!InstallScriptsCheckbox.IsChecked) { dcScriptsPath = null; } new Action(async() => { int result = await Task.Run <int>(() => InstallRelease(srsPath, dcScriptsPath, shortcut)); if (result == 0) { Application.Current.Dispatcher.Invoke(() => { InstallButton.IsEnabled = true; RemoveButton.IsEnabled = true; InstallButton.Content = "Install"; } ); //end-invoke _progressBarDialog.UpdateProgress(true, "Error"); } else if (result == 1) { _progressBarDialog.UpdateProgress(true, "Installed SRS Successfully!"); Logger.Info($"Installed SRS Successfully!"); //open to installation location Process.Start("explorer.exe", srPath.Text); Environment.Exit(0); } else { _progressBarDialog.UpdateProgress(true, "Error with Installation"); MessageBox.Show( "Error with installation - please post your installer-log.txt on the SRS Discord for Support", "Installation Error", MessageBoxButton.OK, MessageBoxImage.Error); Process.Start("https://discord.gg/vqxAw7H"); Process.Start("explorer.exe", GetWorkingDirectory()); Environment.Exit(0); } }).Invoke(); }
private async void InstallReleaseButton(object sender, RoutedEventArgs e) { var dcScriptsPath = dcsScriptsPath.Text; if ((bool)!InstallScriptsCheckbox.IsChecked) { dcScriptsPath = null; } else { var paths = FindValidDCSFolders(dcScriptsPath); if (paths.Count == 0) { MessageBox.Show( "Unable to find DCS Folder in Saved Games!\n\nPlease check the path to the \"Saved Games\" folder\n\nMake sure you are selecting the \"Saved Games\" folder - NOT the DCS folder inside \"Saved Games\" and NOT the DCS installation directory", "SR Standalone Installer", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (IsDCSRunning()) { ShowDCSWarning(); return; } } InstallButton.IsEnabled = false; RemoveButton.IsEnabled = false; InstallButton.Content = "Installing..."; _progressBarDialog = new ProgressBarDialog(); _progressBarDialog.Owner = this; _progressBarDialog.Show(); var srsPath = srPath.Text; var shortcut = CreateStartMenuShortcut.IsChecked ?? true; new Action(async() => { int result = await Task.Run <int>(() => InstallRelease(srsPath, dcScriptsPath, shortcut)); if (result == 0) { Application.Current.Dispatcher.Invoke(() => { InstallButton.IsEnabled = true; RemoveButton.IsEnabled = true; InstallButton.Content = "Install"; } ); //end-invoke _progressBarDialog.UpdateProgress(true, "Error"); } else if (result == 1) { _progressBarDialog.UpdateProgress(true, "Installed SRS Successfully!"); Logger.Info($"Installed SRS Successfully!"); //open to installation location // Process.Start("explorer.exe", srPath.Text); Environment.Exit(0); } else { _progressBarDialog.UpdateProgress(true, "Error with Installation"); MessageBox.Show( "Error with installation - please post your installer-log.txt on the SRS Discord for Support", "Installation Error", MessageBoxButton.OK, MessageBoxImage.Error); Process.Start("https://discord.gg/vqxAw7H"); Process.Start("explorer.exe", GetWorkingDirectory()); Environment.Exit(0); } }).Invoke(); }