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));
            }
Esempio n. 2
0
        public static SystemInterop.RECT GetWorkingArea()
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT();
            SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_GETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_UPDATEINIFILE);
            return(rect);
        }
Esempio n. 3
0
        public static void SetWorkingArea(int left, int top, int right, int bottom)
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT()
            {
                Left = left, Top = top, Right = right, Bottom = bottom
            };
            SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_SETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_UPDATEINIFILE);
        }
Esempio n. 4
0
        public static void SetWorkingArea(int left, int top, int right, int bottom)
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT()
            {
                Left = left, Top = top, Right = right, Bottom = bottom
            };
            bool success = SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_SETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_CHANGE);

            if (!success)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
        }
Esempio n. 5
0
 public SQLiteBase()
 {
     #region SQLlite3_x64
     if (SystemInterop.Is64BitWindows())
     {
         sqlite3_open              = new sqlite3_open_delegate(SQLiteBase.sqlite3_open_x64);
         sqlite3_close             = new sqlite3_close_delegate(SQLiteBase.sqlite3_close_x64);
         sqlite3_exec              = new sqlite3_exec_delegate(SQLiteBase.sqlite3_exec_x64);
         sqlite3_errmsg            = new sqlite3_errmsg_delegate(SQLiteBase.sqlite3_errmsg_x64);
         sqlite3_prepare_v2        = new sqlite3_prepare_v2_delegate(SQLiteBase.sqlite3_prepare_v2_x64);
         sqlite3_step              = new sqlite3_step_delegate(SQLiteBase.sqlite3_step_x64);
         sqlite3_column_count      = new sqlite3_column_count_delegate(SQLiteBase.sqlite3_column_count_x64);
         sqlite3_column_name       = new sqlite3_column_name_delegate(SQLiteBase.sqlite3_column_name_x64);
         sqlite3_column_type       = new sqlite3_column_type_delegate(SQLiteBase.sqlite3_column_type_x64);
         sqlite3_column_int        = new sqlite3_column_int_delegate(SQLiteBase.sqlite3_column_int_x64);
         sqlite3_column_double     = new sqlite3_column_double_delegate(SQLiteBase.sqlite3_column_double_x64);
         sqlite3_column_text       = new sqlite3_column_text_delegate(SQLiteBase.sqlite3_column_text_x64);
         sqlite3_column_blob       = new sqlite3_column_blob_delegate(SQLiteBase.sqlite3_column_blob_x64);
         sqlite3_column_bytes      = new sqlite3_column_bytes_delegate(SQLiteBase.sqlite3_column_bytes_x64);
         sqlite3_column_table_name = new sqlite3_column_table_name_delegate(SQLiteBase.sqlite3_column_table_name_x64);
         sqlite3_finalize          = new sqlite3_finalize_delegate(SQLiteBase.sqlite3_finalize_x64);
         #endregion SQLlite3_x64
         #region SQLlite3_86
     }
     else
     {
         sqlite3_open              = new sqlite3_open_delegate(SQLiteBase.sqlite3_open_x86);
         sqlite3_close             = new sqlite3_close_delegate(SQLiteBase.sqlite3_close_x86);
         sqlite3_exec              = new sqlite3_exec_delegate(SQLiteBase.sqlite3_exec_x86);
         sqlite3_errmsg            = new sqlite3_errmsg_delegate(SQLiteBase.sqlite3_errmsg_x86);
         sqlite3_prepare_v2        = new sqlite3_prepare_v2_delegate(SQLiteBase.sqlite3_prepare_v2_x86);
         sqlite3_step              = new sqlite3_step_delegate(SQLiteBase.sqlite3_step_x86);
         sqlite3_column_count      = new sqlite3_column_count_delegate(SQLiteBase.sqlite3_column_count_x86);
         sqlite3_column_name       = new sqlite3_column_name_delegate(SQLiteBase.sqlite3_column_name_x86);
         sqlite3_column_type       = new sqlite3_column_type_delegate(SQLiteBase.sqlite3_column_type_x86);
         sqlite3_column_int        = new sqlite3_column_int_delegate(SQLiteBase.sqlite3_column_int_x86);
         sqlite3_column_double     = new sqlite3_column_double_delegate(SQLiteBase.sqlite3_column_double_x86);
         sqlite3_column_text       = new sqlite3_column_text_delegate(SQLiteBase.sqlite3_column_text_x86);
         sqlite3_column_blob       = new sqlite3_column_blob_delegate(SQLiteBase.sqlite3_column_blob_x86);
         sqlite3_column_bytes      = new sqlite3_column_bytes_delegate(SQLiteBase.sqlite3_column_bytes_x86);
         sqlite3_column_table_name = new sqlite3_column_table_name_delegate(SQLiteBase.sqlite3_column_table_name_x86);
         sqlite3_finalize          = new sqlite3_finalize_delegate(SQLiteBase.sqlite3_finalize_x86);
     }
     this.database = IntPtr.Zero;
     #endregion SQLlite3_86
 }
        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 alternateSource = new Command {
                MenuText = "Use alternate source..."
            };

            alternateSource.Executed += async(sender, e) => await SwitchRepositorySource();

            var pluginsDirectory = new Command {
                MenuText = "Open plugins directory..."
            };

            pluginsDirectory.Executed += (sender, e) => SystemInterop.OpenFolder(AppInfo.Current.PluginDirectory);

            return(new MenuBar()
            {
                QuitItem = quitCommand,
                ApplicationItems =
                {
                    install,
                    refresh,
                    alternateSource,
                    pluginsDirectory
                }
            });
        }
                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);
 }
Esempio n. 10
0
        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
            });
        }
Esempio n. 11
0
        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;
        }