コード例 #1
0
ファイル: PendingIssuesPage.cs プロジェクト: windygu/AnkhSVN
        public void RefreshPageContents()
        {
            Controls.Clear();

            if (IssueService != null)
            {
                IssueRepository repository = IssueService.CurrentIssueRepository;
                IWin32Window    window     = null;

                if (repository != null &&
                    (window = repository.Window) != null)
                {
                    Control control = Control.FromHandle(window.Handle);
                    if (control != null)
                    {
                        control.Dock = DockStyle.Fill;
                        Controls.Add(control);

                        if (VSVersion.SupportsTheming && Context != null)
                        {
                            IWinFormsThemingService wts = Context.GetService <IWinFormsThemingService>();

                            if (wts != null)
                            {
                                wts.ThemeRecursive(control, false);
                            }
                        }
                        return;
                    }
                }
            }
            Controls.Add(pleaseConfigureLabel);
        }
コード例 #2
0
ファイル: CommandState.cs プロジェクト: pangfd/AnkhSVN2019
        void LoadThemeData()
        {
            if (!VSVersion.VS2012OrLater)
            {
                _themed = false;
                return;
            }

            _themeLight = _themeDark = false;
            IAnkhConfigurationService config = GetService <IAnkhConfigurationService>();
            IWinFormsThemingService   wts    = GetService <IWinFormsThemingService>();

            Guid themeGuid;

            if (config == null || wts == null || !wts.GetCurrentTheme(out themeGuid))
            {
                _themed = false;
                return;
            }

            if (themeGuid == Guid.Empty)
            {
                // Before the first theme switch no theme is set, but the light theme
                // is used anyway
                _themed     = true;
                _themeLight = true;
                _themeDark  = true;
                return;
            }

            using (RegistryKey rk = config.OpenVSInstanceKey("Extensions\\AnkhSVN\\Themes"))
            {
                object v;

                if (rk != null)
                {
                    v = rk.GetValue(themeGuid.ToString("B"));
                }
                else
                {
                    v = null;
                }

                if (v is int)
                {
                    _themed = true;
                    int vv = (int)v;

                    _themeLight = (vv & 0x01) != 0;
                    _themeDark  = (vv & 0x02) != 0;
                }
                else
                {
                    _themed = true;
                }
            }
        }
コード例 #3
0
        private void ThemePage(PendingChangesPage page)
        {
            page._alreadyThemed = true;

            if (VSVersion.SupportsTheming && Context != null)
            {
                IWinFormsThemingService wts = Context.GetService <IWinFormsThemingService>();

                if (wts != null)
                {
                    wts.ThemeRecursive(page, false);
                }
            }
        }
コード例 #4
0
ファイル: VSDialogForm.cs プロジェクト: windygu/AnkhSVN
        protected virtual void ThemeDialog(EventArgs eventArgs)
        {
            if (!DesignMode && VSVersion.SupportsTheming)
            {
                IWinFormsThemingService themer = GetService <IWinFormsThemingService>();

                if (themer != null)
                {
                    if (!IsHandleCreated)
                    {
                        CreateHandle();
                    }
                    themer.ThemeRecursive(this, true);
                }
            }
        }
コード例 #5
0
ファイル: FileIconMapper.cs プロジェクト: windygu/AnkhSVN
        int GetThemeIcon(string path)
        {
            if (themeService == null)
            {
                themeService = GetService <IWinFormsThemingService>();
            }

            IntPtr hIcon;

            if (themeService == null || !themeService.TryGetIcon(path, out hIcon))
            {
                return(-1);
            }

            return(ResolveReference(new ProjectIconReference(hIcon)));
        }
コード例 #6
0
        protected virtual void OnThemeChanged(EventArgs e)
        {
            if (Context == null)
            {
                return;
            }

            IWinFormsThemingService wfts = Context.GetService <IWinFormsThemingService>();

            if (wfts != null)
            {
                wfts.ThemeRecursive(this, false);
            }
            else
            {
                IAnkhVSColor colorSvc = Context.GetService <IAnkhVSColor>();

                if (colorSvc != null)
                {
                    Color color;
                    if (colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TOOLWINDOW_BACKGROUND, out color))
                    {
                        BackColor = color;
                    }

                    if (colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TOOLWINDOW_TEXT, out color))
                    {
                        ForeColor = color;
                    }
                }

                IUIService uis = Context.GetService <IUIService>();

                if (uis != null)
                {
                    Font f = (Font)uis.Styles["DialogFont"];

                    if (f != null)
                    {
                        this.Font = f;
                    }
                }
            }
        }