public PluginSettingStoreEmptyPlaceholder(string friendlyName) { string pluginTypeName = string.IsNullOrWhiteSpace(friendlyName) ? typeof(TSource).Name : $"{friendlyName.ToLower()}s"; base.Items.Add(new StackLayoutItem(null, true)); base.Items.Add( new StackLayoutItem { Control = new Bitmap(App.Logo.WithSize(256, 256)), HorizontalAlignment = HorizontalAlignment.Center } ); base.Items.Add( new StackLayoutItem { Control = $"No plugins containing {pluginTypeName} are installed.", HorizontalAlignment = HorizontalAlignment.Center } ); base.Items.Add( new StackLayoutItem { Control = new LinkButton { Text = "Plugin Repository", Command = new Command( (s, e) => SystemInterop.Open(App.PluginRepositoryUrl) ) }, HorizontalAlignment = HorizontalAlignment.Center } ); base.Items.Add(new StackLayoutItem(null, true)); }
public LinkButtonGroup(string header, string link, string text = null) { var linkButton = new Button { Text = text ?? header, Width = 175, Enabled = !string.IsNullOrEmpty(link) }; linkButton.Click += (sender, e) => SystemInterop.Open(link); this.Text = header; this.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Right, Items = { linkButton } }; this.Orientation = Orientation.Horizontal; }
private MenuBar ConstructMenu() { var quitCommand = new Command { MenuText = "Exit", Shortcut = Keys.Escape }; quitCommand.Executed += (_, _) => this.Close(); var install = new Command { MenuText = "Install plugin...", Shortcut = Application.Instance.CommonModifier | Keys.O }; install.Executed += PromptInstallPlugin; var refresh = new Command { MenuText = "Refresh", Shortcut = Application.Instance.CommonModifier | Keys.R }; refresh.Executed += async(_, _) => await Refresh(); var openRepository = new Command { MenuText = "Get more plugins..." }; openRepository.Executed += (_, _) => SystemInterop.Open(App.PluginRepositoryUrl); return(new MenuBar() { QuitItem = quitCommand, ApplicationItems = { install, refresh, openRepository } }); }
private void ShowPluginFolder(object sender, EventArgs e) { SystemInterop.Open(SelectedPlugin.Directory.FullName); }
private MenuBar ConstructMenu() { var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); var aboutCommand = new Command { MenuText = "About...", Shortcut = Keys.F1 }; aboutCommand.Executed += (sender, e) => App.AboutDialog.ShowDialog(this); var resetSettings = new Command { MenuText = "Reset to defaults" }; resetSettings.Executed += async(sender, e) => await ResetSettings(false); var loadSettings = new Command { MenuText = "Load settings...", Shortcut = Application.Instance.CommonModifier | Keys.O }; loadSettings.Executed += async(sender, e) => await LoadSettingsDialog(); var saveSettingsAs = new Command { MenuText = "Save settings as...", Shortcut = Application.Instance.CommonModifier | Keys.Shift | Keys.S }; saveSettingsAs.Executed += async(sender, e) => await SaveSettingsDialog(); var saveSettings = new Command { MenuText = "Save settings", Shortcut = Application.Instance.CommonModifier | Keys.S }; saveSettings.Executed += async(sender, e) => await SaveSettings(Settings); var applySettings = new Command { MenuText = "Apply settings", Shortcut = Application.Instance.CommonModifier | Keys.Enter }; applySettings.Executed += async(sender, e) => await ApplySettings(); var detectTablet = new Command { MenuText = "Detect tablet", Shortcut = Application.Instance.CommonModifier | Keys.D }; detectTablet.Executed += async(sender, e) => await DetectAllTablets(); var showTabletDebugger = new Command { MenuText = "Tablet debugger..." }; showTabletDebugger.Executed += (sender, e) => ShowTabletDebugger(); var deviceStringReader = new Command { MenuText = "Device string reader..." }; deviceStringReader.Executed += (sender, e) => ShowDeviceStringReader(); var configurationEditor = new Command { MenuText = "Open Configuration Editor...", Shortcut = Application.Instance.CommonModifier | Keys.E }; configurationEditor.Executed += (sender, e) => ShowConfigurationEditor(); var pluginsDirectory = new Command { MenuText = "Open plugins directory..." }; pluginsDirectory.Executed += (sender, e) => SystemInterop.Open(AppInfo.Current.PluginDirectory); var pluginsRepository = new Command { MenuText = "Open plugins repository..." }; pluginsRepository.Executed += (sender, e) => SystemInterop.Open(App.PluginRepositoryUrl); var faqUrl = new Command { MenuText = "Open FAQ Page..." }; faqUrl.Executed += (sender, e) => SystemInterop.Open(App.FaqUrl); var exportDiagnostics = new Command { MenuText = "Export diagnostics..." }; exportDiagnostics.Executed += async(sender, e) => await ExportDiagnostics(); return(new MenuBar { Items = { // File submenu new ButtonMenuItem { Text = "&File", Items = { loadSettings, saveSettings, saveSettingsAs, resetSettings, applySettings } }, // Tablets submenu new ButtonMenuItem { Text = "Tablets", Items = { detectTablet, showTabletDebugger, deviceStringReader, configurationEditor } }, // Plugins submenu new ButtonMenuItem { Text = "Plugins", Items = { pluginsDirectory, pluginsRepository } }, new ButtonMenuItem { Text = "&Help", Items = { faqUrl, exportDiagnostics } } }, ApplicationItems = { // application (OS X) or file menu (others) }, QuitItem = quitCommand, AboutItem = aboutCommand }); }
public MetadataViewer() { actions = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { new StackLayoutItem { Expand = true, Control = uninstallButton = new Button(UninstallHandler) { Text = "Uninstall" } }, new StackLayoutItem { Expand = true, Control = installButton = new Button(InstallHandler) } } }; var installedBinding = new DelegateBinding <bool>( () => { var contexts = AppInfo.PluginManager.GetLoadedPlugins(); return(contexts.Any(t => PluginMetadata.Match(t.GetMetadata(), Metadata))); }, addChangeEvent: (e) => MetadataChanged += e, removeChangeEvent: (e) => MetadataChanged -= e ); var updateableBinding = new DelegateBinding <bool>( () => { var repo = PluginMetadataList.Repository; if (repo == null) { return(false); } var updatableFromRepository = from meta in repo where PluginMetadata.Match(meta, Metadata) where meta.PluginVersion > Metadata.PluginVersion where CurrentDriverVersion >= meta.SupportedDriverVersion orderby meta.PluginVersion descending select meta; return(updatableFromRepository.Any()); }, addChangeEvent: (e) => MetadataChanged += e, removeChangeEvent: (e) => MetadataChanged -= e ); var installableBinding = new DelegateBinding <bool>( () => updateableBinding.GetValue() || !installedBinding.GetValue(), addChangeEvent: (e) => MetadataChanged += e, removeChangeEvent: (e) => MetadataChanged += e ); uninstallButton.GetEnabledBinding().Bind(installedBinding); installButton.TextBinding.Bind(updateableBinding.Convert(c => c ? "Update" : "Install")); installButton.GetEnabledBinding().Bind(installableBinding); content = new Scrollable { Content = new StackLayout { Padding = 5, Spacing = 5, HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { new AlignedGroup { Text = "Name", Content = name = new Label() }, new AlignedGroup { Text = "Owner", Content = owner = new Label() }, new AlignedGroup { Text = "Description", Content = description = new Label { Wrap = WrapMode.Word } }, new AlignedGroup { Text = "Driver Version", Content = driverVersion = new Label() }, new AlignedGroup { Text = "Plugin Version", Content = pluginVersion = new Label() }, new AlignedGroup { Text = "Source Code Repository", Content = sourceCode = new Button { Width = 175, Text = "Show source code" } }, new AlignedGroup { Text = "Wiki", Content = wiki = new Button { Width = 175, Text = "Show plugin wiki" } }, new AlignedGroup { Text = "License", Content = license = new Label() }, new StackLayoutItem(null, true), actions } } }; name.TextBinding.Bind(MetadataBinding.Child(c => c.Name)); owner.TextBinding.Bind(MetadataBinding.Child(c => c.Owner)); description.TextBinding.Bind(MetadataBinding.Child(c => c.Description)); driverVersion.TextBinding.Bind(MetadataBinding.Child(c => c.SupportedDriverVersion).Convert(v => v?.ToString())); pluginVersion.TextBinding.Bind(MetadataBinding.Child(c => c.PluginVersion).Convert(v => v?.ToString())); license.TextBinding.Bind(MetadataBinding.Child(c => c.LicenseIdentifier)); sourceCode.GetEnabledBinding().Bind(MetadataBinding.Child(c => c.RepositoryUrl).Convert(c => c != null)); sourceCode.Click += (sender, e) => SystemInterop.Open(Metadata.RepositoryUrl); wiki.GetEnabledBinding().Bind(MetadataBinding.Child(c => c.WikiUrl).Convert(c => c != null)); wiki.Click += (sender, e) => SystemInterop.Open(Metadata.WikiUrl); AppInfo.PluginManager.AssembliesChanged += HandleAssembliesChanged; }