Пример #1
0
        public static ThemeProvider Deserialize(string serialized)
        {
            try
            {
                var tp        = new ThemeProvider();
                var rootElt   = XElement.Parse(serialized);
                var themesXml = rootElt.Elements("theme");
                foreach (var tx in themesXml)
                {
                    var t = Theme.LoadFromXml(tx);
                    tp._themes.Add(t);
                }

                tp.CurrentThemeName = rootElt.Attribute("Current").Value;

                if (tp._themes.Count == 0)
                {
                    throw new Exception("load defaults then");
                }

                return(tp);
            }
            catch (Exception)
            {
                var tp = new ThemeProvider();
                tp._themes = new List <Theme>();
                tp._themes.Add(Theme.GetDefaultLightTheme());
                tp._themes.Add(Theme.GetDefaultDarkTheme());
                tp._themes.Add(Theme.GetDefaultBlueTheme());
                tp.CurrentThemeName = tp._themes.First().Name;
                return(tp);
            }
        }
Пример #2
0
        public void ApplySettings()
        {
            treeView1.Indent      = 10;
            treeView1.DrawMode    = TreeViewDrawMode.OwnerDrawAll;
            treeView1.ShowLines   = false;
            treeView1.Font        = Settings.TreeFont ?? Font;
            taskListDataGrid.Font = treeView1.Font;

            // Colors
            var tp = ThemeProvider.Deserialize(Settings.ThemeSettingsSerialized);

            _colorTable = tp.CurrentTheme.Colors;

            var colorHash = _colorTable.GetHash();

            if (_colorTableHash == colorHash)
            {
                return;
            }
            _colorTableHash = colorHash;

            BackColor                        = _colorTable.ControlBackground;
            ForeColor                        = _colorTable.ControlText;
            treeView1.BackColor              = _colorTable.WindowBackground;
            treeView1.ForeColor              = _colorTable.WindowText;
            lbTaskList.ForeColor             = _colorTable.TabText;
            taskListDataGrid.BackColor       = _colorTable.WindowBackground;
            taskListDataGrid.BackgroundColor = _colorTable.WindowBackground;
            taskListDataGrid.ForeColor       = _colorTable.WindowText;
            taskListDataGrid.GridColor       = _colorTable.GridLines;
            taskListDataGrid.RowsDefaultCellStyle.BackColor = _colorTable.WindowBackground;
            taskListDataGrid.RowsDefaultCellStyle.ForeColor = _colorTable.WindowText;

            toolStrip2.BackColor = _colorTable.MenuBackground;
        }
        public void InitSettings()
        {
            chTrackActiveItem.Checked    = Settings.Default.TrackActiveItem;
            edExtensions.Text            = string.Join(" ", Settings.Default.Extensions.OfType <string>().Select(s => s.Replace(".", "")).ToArray());
            chScriptStripEnabled.Checked = Settings.Default.ScriptStripEnabled;
            edScriptStripEtensions.Text  = string.Join(" ", Settings.Default.ScriptStripExtensions.OfType <string>().Select(s => s.Replace(".", "")).ToArray());

            var treeFont = Settings.Default.TreeFont ?? _defaultTreeFont;

            btnSelectTreeFont.Text = treeFont.Name + " (" + treeFont.Size + ")";
            btnSelectTreeFont.Font = treeFont;

            taggedFuncLabel2.Font      = treeFont;
            taggedFuncLabel3.Font      = treeFont;
            taggedFuncLabel4.Font      = treeFont;
            taggedFuncLabel5.Font      = treeFont;
            taggedFuncLabel6.Font      = treeFont;
            colorPicker2.SelectedColor = Settings.Default.taggedFunction2Color;
            colorPicker3.SelectedColor = Settings.Default.taggedFunction3Color;
            colorPicker4.SelectedColor = Settings.Default.taggedFunction4Color;
            colorPicker5.SelectedColor = Settings.Default.taggedFunction5Color;
            colorPicker6.SelectedColor = Settings.Default.taggedFunction6Color;

            numericUpDownMaxParametersLength.Value = Settings.Default.MaxParametersLength;
            numericUpDownMaxParametersLengthInFunctionChain.Value = Settings.Default.MaxParametersLengthInFunctionChain;

            chSendStatistics.Checked   = Settings.Default.SendStatistics;
            chFixAspNet.Checked        = Settings.Default.FixAspNetTags;
            edFixAspNetExtensions.Text = string.Join(" ", Settings.Default.FixAspNetTagsExtensions.OfType <string>().Select(s => s.Replace(".", "")).ToArray());
            chFixRazor.Checked         = Settings.Default.FixRazorSyntax;
            edFixRazorExtensions.Text  = string.Join(" ", Settings.Default.FixRazorSyntaxExtensions.OfType <string>().Select(s => s.Replace(".", "")).ToArray());

            edToDoKeyWords.Text = String.Join(", ", Settings.Default.ToDoKeywords.OfType <string>().ToArray());

            chShowErrorNotificationOnTopOfTheEditor.Checked = Settings.Default.ShowErrorsNotificationOnTopOfEditor;

            var themesSerialized = Settings.Default.ThemeSettingsSerialized;

            _themeProvider = ThemeProvider.Deserialize(themesSerialized);

            ReInitThemesComboBox();
        }