protected override void OnRuntimeLoad(EventArgs e)
        {
            base.OnRuntimeLoad(e);

            settingsTreeView.SuspendLayout();

            ChecklistSettingsPage checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(this);

            // Git Extensions settings
            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsGroup(), null, Images.GitExtensionsLogo16);
            var gitExtPageRef = GitExtensionsSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(checklistSettingsPage, gitExtPageRef, icon: null, asRoot: true);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GeneralSettingsPage>(this), gitExtPageRef, Images.GeneralSettings);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceSettingsPage>(this), gitExtPageRef, Images.Appearance);
            var appearanceSettingsPage = AppearanceSettingsPage.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ColorsSettingsPage>(this), appearanceSettingsPage, Images.Colors);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceFontsSettingsPage>(this), appearanceSettingsPage, Images.Font.AdaptLightness());

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <RevisionLinksSettingsPage>(this), gitExtPageRef, Images.Link.AdaptLightness());
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <BuildServerIntegrationSettingsPage>(this), gitExtPageRef, Images.Integration);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ScriptsSettingsPage>(this), gitExtPageRef, Images.Console);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <HotkeysSettingsPage>(this), gitExtPageRef, Images.Hotkey);

            if (EnvUtils.RunningOnWindows())
            {
                settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ShellExtensionSettingsPage>(this), gitExtPageRef, Images.ShellExtensions);
            }

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AdvancedSettingsPage>(this), gitExtPageRef, Images.AdvancedSettings);
            SettingsPageReference advancedPageRef = AdvancedSettingsPage.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ConfirmationsSettingsPage>(this), advancedPageRef, Images.BisectGood);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DetailedSettingsPage>(this), gitExtPageRef, Images.Settings);
            var detailedSettingsPage = DetailedSettingsPage.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <FormBrowseRepoSettingsPage>(this), detailedSettingsPage, Images.BranchFolder);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <CommitDialogSettingsPage>(this), detailedSettingsPage, Images.CommitSummary);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DiffViewerSettingsPage>(this), detailedSettingsPage, Images.Diff);

            var sshSettingsPage = SettingsPageBase.Create <SshSettingsPage>(this);

            settingsTreeView.AddSettingsPage(sshSettingsPage, gitExtPageRef, Images.Key);
            checklistSettingsPage.SshSettingsPage = sshSettingsPage;

            // Git settings
            settingsTreeView.AddSettingsPage(new GitSettingsGroup(), null, Images.GitLogo16);
            var gitPageRef = GitSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitSettingsPage>(this), gitPageRef, Images.FolderOpen);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitConfigSettingsPage>(this), gitPageRef, Images.GeneralSettings);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitConfigAdvancedSettingsPage>(this), gitPageRef, Images.AdvancedSettings);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitRootIntroductionPage>(this), gitPageRef, icon: null, asRoot: true);

            // Plugins settings
            settingsTreeView.AddSettingsPage(new PluginsSettingsGroup(), null, Images.Plugin);
            SettingsPageReference pluginsPageRef = PluginsSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <PluginRootIntroductionPage>(this), pluginsPageRef, icon: null, asRoot: true);

            lock (PluginRegistry.Plugins)
            {
                var pluginEntries = PluginRegistry.Plugins
                                    .Where(p => p.HasSettings)
                                    .Select(plugin => (Plugin: plugin, Page: PluginSettingsPage.CreateSettingsPageFromPlugin(this, plugin)))
                                    .OrderBy(entry => entry.Page.GetTitle(), StringComparer.CurrentCultureIgnoreCase);

                foreach (var entry in pluginEntries)
                {
                    settingsTreeView.AddSettingsPage(entry.Page, pluginsPageRef, entry.Plugin.Icon as Bitmap);
                }
            }

            settingsTreeView.ResumeLayout();
        }
示例#2
0
        public FormSettings([NotNull] GitUICommands commands, SettingsPageReference initialPage = null)
            : base(commands)
        {
            InitializeComponent();
            _translatedTitle = Text;

            settingsTreeView.SuspendLayout();

#if DEBUG
            buttonDiscard.Visible = true;
#endif

            _commonLogic       = new CommonLogic(Module);
            CheckSettingsLogic = new CheckSettingsLogic(_commonLogic);

            var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(this);

            // Git Extensions settings
            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsGroup(), null, Images.GitExtensionsLogo16);
            var gitExtPageRef = GitExtensionsSettingsGroup.GetPageReference();
            settingsTreeView.AddSettingsPage(checklistSettingsPage, gitExtPageRef, icon: null, asRoot: true);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GeneralSettingsPage>(this), gitExtPageRef, Images.GeneralSettings);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceSettingsPage>(this), gitExtPageRef, Images.Appearance);
            var appearanceSettingsPage = AppearanceSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ColorsSettingsPage>(this), appearanceSettingsPage, Images.Colors);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceFontsSettingsPage>(this), appearanceSettingsPage, Images.Font);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <RevisionLinksSettingsPage>(this), gitExtPageRef, Images.Link);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <BuildServerIntegrationSettingsPage>(this), gitExtPageRef, Images.Integration);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ScriptsSettingsPage>(this), gitExtPageRef, Images.Console);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <HotkeysSettingsPage>(this), gitExtPageRef, Images.Hotkey);

            if (EnvUtils.RunningOnWindows())
            {
                settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ShellExtensionSettingsPage>(this), gitExtPageRef, Images.ShellExtensions);
            }

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AdvancedSettingsPage>(this), gitExtPageRef, Images.AdvancedSettings);
            SettingsPageReference advancedPageRef = AdvancedSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ConfirmationsSettingsPage>(this), advancedPageRef, Images.BisectGood);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DetailedSettingsPage>(this), gitExtPageRef, Images.Settings);
            var detailedSettingsPage = DetailedSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <FormBrowseRepoSettingsPage>(this), detailedSettingsPage, Images.BranchFolder);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <CommitDialogSettingsPage>(this), detailedSettingsPage, Images.CommitSummary);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DiffViewerSettingsPage>(this), detailedSettingsPage, Images.Diff);

            var sshSettingsPage = SettingsPageBase.Create <SshSettingsPage>(this);
            settingsTreeView.AddSettingsPage(sshSettingsPage, gitExtPageRef, Images.Key);
            checklistSettingsPage.SshSettingsPage = sshSettingsPage;

            // Git settings
            settingsTreeView.AddSettingsPage(new GitSettingsGroup(), null, Images.GitLogo16);
            var gitPageRef = GitSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitSettingsPage>(this), gitPageRef, Images.FolderOpen);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitConfigSettingsPage>(this), gitPageRef, Images.GeneralSettings);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitConfigAdvancedSettingsPage>(this), gitPageRef, Images.AdvancedSettings);

            // Plugins settings
            settingsTreeView.AddSettingsPage(new PluginsSettingsGroup(), null, Images.Plugin);
            SettingsPageReference pluginsPageRef = PluginsSettingsGroup.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <PluginRootIntroductionPage>(this), pluginsPageRef, icon: null, asRoot: true);

            var pluginEntries = PluginRegistry.Plugins
                                .Select(plugin => (Plugin: plugin, Page: PluginSettingsPage.CreateSettingsPageFromPlugin(this, plugin)))
                                .OrderBy(entry => entry.Page.GetTitle(), StringComparer.CurrentCultureIgnoreCase);

            foreach (var entry in pluginEntries)
            {
                settingsTreeView.AddSettingsPage(entry.Page, pluginsPageRef, entry.Plugin.Icon as Bitmap);
            }

            if (initialPage == null && _lastSelectedSettingsPageType != null)
            {
                initialPage = new SettingsPageReferenceByType(_lastSelectedSettingsPageType);
            }

            settingsTreeView.GotoPage(initialPage);
            settingsTreeView.ResumeLayout();

            InitializeComplete();
        }
示例#3
0
        public FormSettings(GitUICommands commands, SettingsPageReference initalPage = null)
            : base(commands)
        {
            InitializeComponent();
            Translate();
            _translatedTitle = Text;

            settingsTreeView.SuspendLayout();

            // if form is created for translation purpose
            if (commands == null)
            {
                return;
            }

#if DEBUG
            buttonDiscard.Visible = true;
#endif

            _commonLogic       = new CommonLogic(Module);
            CheckSettingsLogic = new CheckSettingsLogic(_commonLogic);

            var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(this);

            // Git Extensions settings
            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsGroup(), null);
            var gitExtPageRef = GitExtensionsSettingsGroup.GetPageReference();
            settingsTreeView.AddSettingsPage(checklistSettingsPage, gitExtPageRef, true); // as root

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GeneralSettingsPage>(this), gitExtPageRef);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceSettingsPage>(this), gitExtPageRef);
            var appearanceSettingsPage = AppearanceSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ColorsSettingsPage>(this), appearanceSettingsPage);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AppearanceFontsSettingsPage>(this), appearanceSettingsPage);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <RevisionLinksSettingsPage>(this), gitExtPageRef);

            var buildServerIntegrationSettingsPage = SettingsPageBase.Create <BuildServerIntegrationSettingsPage>(this);
            settingsTreeView.AddSettingsPage(buildServerIntegrationSettingsPage, gitExtPageRef);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ScriptsSettingsPage>(this), gitExtPageRef);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <HotkeysSettingsPage>(this), gitExtPageRef);

            if (EnvUtils.RunningOnWindows())
            {
                settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ShellExtensionSettingsPage>(this), gitExtPageRef);
            }

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <AdvancedSettingsPage>(this), gitExtPageRef);
            SettingsPageReference advancedPageRef = AdvancedSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <ConfirmationsSettingsPage>(this), advancedPageRef);

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DetailedSettingsPage>(this), gitExtPageRef);
            var detailedSettingsPage = DetailedSettingsPage.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <FormBrowseRepoSettingsPage>(this), detailedSettingsPage);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <CommitDialogSettingsPage>(this), detailedSettingsPage);
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <DiffViewerSettingsPage>(this), detailedSettingsPage);

            var sshSettingsPage = SettingsPageBase.Create <SshSettingsPage>(this);
            settingsTreeView.AddSettingsPage(sshSettingsPage, gitExtPageRef);
            checklistSettingsPage.SshSettingsPage = sshSettingsPage;

            // Git settings
            settingsTreeView.AddSettingsPage(new GitSettingsGroup(), null);
            var gitPageRef = GitSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <GitSettingsPage>(this), gitPageRef);

            var gitConfigSettingsSettingsPage = SettingsPageBase.Create <GitConfigSettingsPage>(this);
            settingsTreeView.AddSettingsPage(gitConfigSettingsSettingsPage, gitPageRef);

            var gitConfigAdvancedSettingsPage = SettingsPageBase.Create <GitConfigAdvancedSettingsPage>(this);
            settingsTreeView.AddSettingsPage(gitConfigAdvancedSettingsPage, gitPageRef);

            // Plugins settings
            settingsTreeView.AddSettingsPage(new PluginsSettingsGroup(), null);
            SettingsPageReference pluginsPageRef = PluginsSettingsGroup.GetPageReference();
            settingsTreeView.AddSettingsPage(SettingsPageBase.Create <PluginRootIntroductionPage>(this), pluginsPageRef, true); // as root
            foreach (var gitPlugin in PluginRegistry.Plugins)
            {
                var settingsPage = PluginSettingsPage.CreateSettingsPageFromPlugin(this, gitPlugin);
                settingsTreeView.AddSettingsPage(settingsPage, pluginsPageRef);
            }

            settingsTreeView.GotoPage(initalPage);
            settingsTreeView.ResumeLayout();

            this.AdjustForDpiScaling();
        }