protected async Task UninstallPlugin(DesktopPluginContext context) { if (await App.Driver.Instance.UninstallPlugin(context.FriendlyName)) { AppInfo.PluginManager.UnloadPlugin(context); await Refresh(); } else { MessageBox.Show(this, $"'{context.FriendlyName}' failed to uninstall", "Plugin Manager", MessageBoxType.Error); } }
protected override void OnSelectedValueChanged(EventArgs e) { base.OnSelectedValueChanged(e); var metadata = SelectedValue as PluginMetadata; SelectedMetadataChanged?.Invoke(metadata); this.SelectedPlugin = SelectedValue is PluginMetadata selected?InstalledPlugins.FirstOrDefault(p => PluginMetadata.Match(selected, p.GetMetadata())) : null; SelectedPluginChanged?.Invoke(this.SelectedPlugin); }
protected async Task Uninstall(DesktopPluginContext context) { context.Directory.Refresh(); if (context.Directory.Exists && !await App.Driver.Instance.UninstallPlugin(context.FriendlyName)) { MessageBox.Show(this, $"'{context.FriendlyName}' failed to uninstall", "Plugin Manager", MessageBoxType.Error); return; } AppInfo.PluginManager.UnloadPlugin(context); await Refresh(); }
protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); var index = base.SelectedIndex; if (index >= 0 && index < DisplayedPlugins.Count) { this.SelectedPlugin = DisplayedPlugins[index]; base.ContextMenu = ItemContextMenu; } else { this.SelectedPlugin = null; base.ContextMenu = null; } }