public void btnDone_Click(object sender, RoutedEventArgs args) { _selectedPlugin = null; Close(); }
private void btnRemove_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBoxResult.None; StringBuilder loadedPlugins = new StringBuilder(); if (_selectedPlugin != null) { result = MessageBox.Show(this, "This action requires a restart of the program. Are you sure you wish to remove this plugin?", "Are You Sure?", MessageBoxButton.YesNo, MessageBoxImage.Question); } else { MessageBox.Show(this, "You must select an item to be removed.", "No Selection Made...", MessageBoxButton.OK, MessageBoxImage.Asterisk); return; } if (result == MessageBoxResult.Yes) { // Remove the item from the list of loaded plugins _pluginList.Remove(_selectedPlugin); _selectedPlugin = null; // Update the Application Setting foreach (Plugin nextPlugin in _pluginList) { loadedPlugins.Append(nextPlugin.PluginPath + Variables.SETTINGS_SEPARATOR); } Properties.ApplicationSettings.Default[Variables.SETTINGS_APPLICATION_PLUGINS] = loadedPlugins.ToString(); Properties.ApplicationSettings.Default.Save(); // Restart try { Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); } catch (Exception ex) { PluginManager.log.Error("An exception was thrown while attempting to restart the application as a result of a plugin removal.", ex); } } }