public static void SetColorScheme(string colorScheme) { try { ColorScheme = GetColorScheme(colorScheme); } catch (InvalidOperationException) { MessageBox.Show("Color scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } try { if (StyleScheme == null) { StyleScheme = GetStyleScheme(Properties.Settings.Default.StyleScheme); } } catch { MessageBox.Show("Style scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } Background = ColorScheme.Background; Carret = ColorScheme.Carret; LineNumber = ColorScheme.LineNumber; ServiceLine = ColorScheme.ServiceLine; Selection = ColorScheme.Selection; Default = new TextStyle(new SolidBrush(ColorScheme.Text), null, FontStyle.Regular); SameWord = new TextStyle(new SolidBrush(ColorScheme.SameWordText), new SolidBrush(ColorScheme.SameWord), StyleScheme.SameWord); Comment = new TextStyle(new SolidBrush(ColorScheme.Comment), null, StyleScheme.Comment); Keyword0 = new TextStyle(new SolidBrush(ColorScheme.Keyword), null, StyleScheme.Keyword); Keyword1 = new TextStyle(new SolidBrush(ColorScheme.Keyword1), null, StyleScheme.Keyword1); Keyword2 = new TextStyle(new SolidBrush(ColorScheme.Keyword2), null, StyleScheme.Keyword2); Keyword3 = new TextStyle(new SolidBrush(ColorScheme.Keyword3), null, StyleScheme.Keyword3); Keyword4 = new TextStyle(new SolidBrush(ColorScheme.Keyword4), null, StyleScheme.Keyword4); Number = new TextStyle(new SolidBrush(ColorScheme.Number), null, StyleScheme.Number); Time = new TextStyle(new SolidBrush(ColorScheme.Time), null, StyleScheme.Time); Special = new TextStyle(new SolidBrush(ColorScheme.Special), null, StyleScheme.Special); Command = new TextStyle(new SolidBrush(ColorScheme.Command), null, StyleScheme.Command); Path = new TextStyle(new SolidBrush(ColorScheme.Path), null, StyleScheme.Path); SearchResult = new TargetStyle(ColorScheme.SearchResultBack, ColorScheme.SearchResultFrame); ReplaceResult = new TargetStyle(ColorScheme.ReplaceResultBack, ColorScheme.ReplaceResultFrame); }
public static void SetColorScheme(string colorScheme) { try { ColorScheme = GetColorScheme(colorScheme); } catch (InvalidOperationException) { MessageBox.Show("Color scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } try { if (StyleScheme == null) StyleScheme = GetStyleScheme(Properties.Settings.Default.StyleScheme); } catch { MessageBox.Show("Style scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } Background = ColorScheme.Background; Carret = ColorScheme.Carret; LineNumber = ColorScheme.LineNumber; ServiceLine = ColorScheme.ServiceLine; Selection = ColorScheme.Selection; Default = new TextStyle(new SolidBrush(ColorScheme.Text), null, FontStyle.Regular); SameWord = new TextStyle(new SolidBrush(ColorScheme.SameWordText), new SolidBrush(ColorScheme.SameWord), StyleScheme.SameWord); Comment = new TextStyle(new SolidBrush(ColorScheme.Comment), null, StyleScheme.Comment); Keyword0 = new TextStyle(new SolidBrush(ColorScheme.Keyword), null, StyleScheme.Keyword); Keyword1 = new TextStyle(new SolidBrush(ColorScheme.Keyword1), null, StyleScheme.Keyword1); Keyword2 = new TextStyle(new SolidBrush(ColorScheme.Keyword2), null, StyleScheme.Keyword2); Keyword3 = new TextStyle(new SolidBrush(ColorScheme.Keyword3), null, StyleScheme.Keyword3); Keyword4 = new TextStyle(new SolidBrush(ColorScheme.Keyword4), null, StyleScheme.Keyword4); Number = new TextStyle(new SolidBrush(ColorScheme.Number), null, StyleScheme.Number); Time = new TextStyle(new SolidBrush(ColorScheme.Time), null, StyleScheme.Time); Special = new TextStyle(new SolidBrush(ColorScheme.Special), null, StyleScheme.Special); Command = new TextStyle(new SolidBrush(ColorScheme.Command), null, StyleScheme.Command); Path = new TextStyle(new SolidBrush(ColorScheme.Path), null, StyleScheme.Path); SearchResult = new TargetStyle(ColorScheme.SearchResultBack, ColorScheme.SearchResultFrame); ReplaceResult = new TargetStyle(ColorScheme.ReplaceResultBack, ColorScheme.ReplaceResultFrame); }