public async void Delete() { try { if (plugin.IsFailed) { // if plugin loading failed, it can already been loaded into AppDomain, so it isn't safe to delete it right away // because dll's may be in use PluginManager.MarkForRemoval(InternalName); } else if (plugin.IsLoaded && plugin.Package.HasValue) { // begin plugin toggle process in other thread await pluginToggleTask; pluginToggleTask = SetPluginEnabled(false); await pluginToggleTask.ConfigureAwait(false); // NOTE: synchronisation might be helpful here, but I don't anticipate multiple calls to this method // in short succession, so it is kept simpler PluginManager.MarkForRemoval(InternalName); } else { try { PluginManager.DeleteNonPreloadedPlugin(InternalName); } catch (Exception ex) { Dispatch(() => MessageBox.Show(ex.Message)); Debugger.Warn(ex); PluginManager.MarkForRemoval(InternalName); } } Dispatch(() => { pluginList.UpdatePluginsArrangement(); OnPropertyChanged(nameof(IsEnabled)); }); } catch (Exception ex) { Dispatch(() => MessageBox.Show(ex.Message)); } }
public void Delete() { try { PluginManager.DeleteNonPreloadedPlugin(entry.InternalName); pluginList.UpdatePluginsArrangement(); OnPropertyChanged(nameof(CanDelete)); OnPropertyChanged(nameof(CanInstall)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error on delete", MessageBoxButton.OK, MessageBoxImage.Error); PluginManager.MarkForRemoval(entry.InternalName); pluginList.UpdatePluginsArrangement(); OnPropertyChanged(nameof(CanDelete)); OnPropertyChanged(nameof(CanInstall)); } }
public void Delete() { try { PluginManager.DeleteNonPreloadedPlugin(entry.InternalName); // when plugin is removed, we shouldn't be able to open it's folder anymore if (openDirAction != null) { this.Actions.Remove(openDirAction); openDirAction = null; } pluginList.UpdatePluginsArrangement(); OnPropertyChanged(nameof(CanDelete)); OnPropertyChanged(nameof(CanInstall)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error on delete", MessageBoxButton.OK, MessageBoxImage.Error); PluginManager.MarkForRemoval(entry.InternalName); pluginList.UpdatePluginsArrangement(); OnPropertyChanged(nameof(CanDelete)); OnPropertyChanged(nameof(CanInstall)); } }