/// <summary> /// Načte nastavení z uloženého souboru. V případě poškození načte základní nastavení. /// </summary> private void NacistNastaveni() { using (var cteni = new StreamReader(SlozkaSouboru + "\\Nastaveni.txt")) { try { var radek = cteni.ReadLine().Split(':'); Port = int.Parse(radek[1].Trim()); radek = cteni.ReadLine().Split(':'); if (radek[1].Trim() == "LIGHT") { Tema = MaterialSkinManager.Themes.LIGHT; } else { Tema = MaterialSkinManager.Themes.DARK; } radek = cteni.ReadLine().Split(':'); PocetPripojeni = int.Parse(radek[1].Trim()); radek = cteni.ReadLine().Split(':'); UlozeniHistorie = bool.Parse(radek[1].Trim()); radek = cteni.ReadLine().Split(':'); Kontrola = int.Parse(radek[1].Trim()); } catch { ZakladniNastaveni(); } } }
/// <summary> /// Change themes between metro light and dark /// </summary> /// <param name="isDarkTheme"></param> private void ChangeTheme(bool isDarkTheme) { Color gridForeColor = Color.Black; Color backColor = Color.White; MaterialSkinManager.Themes themeToSet = MaterialSkinManager.Themes.LIGHT; if (isDarkTheme) { gridForeColor = Color.White; backColor = Color.DarkGray; themeToSet = MaterialSkinManager.Themes.DARK; } //dgv not works well with dark mode so we need to change it manually dgvFileInfo.ForeColor = gridForeColor; dgvPatterns.ForeColor = gridForeColor; MaterialSkinManager.Theme = themeToSet; foreach (DataGridViewRow row in dgvFileInfo.Rows) { row.DefaultCellStyle.BackColor = backColor; } foreach (DataGridViewRow row in dgvPatterns.Rows) { row.DefaultCellStyle.BackColor = backColor; } }
/// <summary> /// Načte základní nastavení. /// </summary> private void ZakladniNastaveni() { Port = 8888; PocetPripojeni = 0; txtPocetKlientu.Text = PocetPripojeni.ToString(); Tema = MaterialSkinManager.Themes.LIGHT; UlozeniHistorie = true; Kontrola = 100; }
public Main(Config config) { Config = config; Scheme = SkinManager.ColorScheme; Theme = SkinManager.Theme; InitializeComponent(); LoadLocale(config.Locale); }
private int getIndexForTheme(MaterialSkinManager.Themes theme) { switch (theme) { case MaterialSkinManager.Themes.LIGHT: return(0); case MaterialSkinManager.Themes.DARK: return(1); } return(0); }
public ggLoL(MaterialSkinManager.Themes theme, Primary colorP, Primary darkP, Primary lightP, Accent accent, TextShade shade) { InitializeComponent(); msm = MaterialSkinManager.Instance; msm.AddFormToManage(this); msm.Theme = theme; msm.ColorScheme = new ColorScheme( colorP, darkP, lightP, accent, shade); timer.Start(); }
public ColorOverlay(Point Origin, MaterialSkinManager.Themes Theme, MaterialForm BaseFormToOverlay, MaterialSettings pSettingsDialog) { _SettingsDialog = pSettingsDialog; _BaseForm = BaseFormToOverlay; _ThemeToApply = Theme; _Origin = Origin; applyTheme = true; FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; InitializeComponent(); objAnimationManager = new AnimationManager() { Increment = 0.015, AnimationType = AnimationType.EaseInOut }; DoubleBuffered = true; objAnimationManager.OnAnimationProgress += sender => Invalidate(); objAnimationManager.OnAnimationFinished += objAnimationManager_OnAnimationFinished; }
public Settings() { var key = Registry.CurrentUser; key = createAndGetSubkey(key, "Software"); key = createAndGetSubkey(key, "LightController"); key = createAndGetSubkey(key, "0.1"); createAndSetKeyIfNotExists(key, "ip"); createAndSetKeyIfNotExists(key, "theme"); createAndSetKeyIfNotExists(key, "colorSchemePrimary"); createAndSetKeyIfNotExists(key, "colorSchemeLightPrimary"); createAndSetKeyIfNotExists(key, "colorSchemeDarkPrimary"); createAndSetKeyIfNotExists(key, "colorSchemeAccentPrimary"); createAndSetKeyIfNotExists(key, "colorSchemeTextShade"); createAndSetKeyIfNotExists(key, "colorSchemeIndex"); createAndSetKeyIfNotExists(key, "hideOnStartup"); Enum.TryParse((string)key.GetValue("theme"), out MaterialSkinManager.Themes themeVar); Enum.TryParse((string)key.GetValue("colorSchemePrimary"), out Primary colorSchemePrimaryVar); Enum.TryParse((string)key.GetValue("colorSchemeLightPrimary"), out Primary colorSchemeLightPrimaryVar); Enum.TryParse((string)key.GetValue("colorSchemeDarkPrimary"), out Primary colorSchemeDarkPrimaryVar); Enum.TryParse((string)key.GetValue("colorSchemeAccentPrimary"), out Accent colorSchemeAccentPrimaryVar); Enum.TryParse((string)key.GetValue("colorSchemeTextShade"), out TextShade colorSchemeTextShadeVar); this.ipVar = (string)key.GetValue("ip"); this.colorSchemeIndexVar = Convert.ToInt32(key.GetValue("colorSchemeIndex").ToString()); this.hideOnStartupVar = Convert2.stringToBool(key.GetValue("hideOnStartup").ToString()); this.themeVar = themeVar; this.colorSchemePrimaryVar = colorSchemePrimaryVar; this.colorSchemeLightPrimaryVar = colorSchemeLightPrimaryVar; this.colorSchemeDarkPrimaryVar = colorSchemeDarkPrimaryVar; this.colorSchemeAccentPrimaryVar = colorSchemeAccentPrimaryVar; this.colorSchemeTextShadeVar = colorSchemeTextShadeVar; this.themeVar = themeVar; this.regKey = key; }
/// <summary> /// Nastaví program podle uložených nastavení. /// Pokud nastavení nelze načíst, načte základní hodnoty. /// </summary> private void NacistNastaveni() { using (var cteni = new StreamReader(SlozkaSouboru + "\\Nastaveni.txt")) { var radek = cteni.ReadLine().Split(':'); AdresaServeru = IPAddress.Parse(radek[1].Trim()); radek = cteni.ReadLine().Split(':'); Port = int.Parse(radek[1].Trim()); radek = cteni.ReadLine().Split(':'); if (radek[1].Trim() == "LIGHT") { Tema = MaterialSkinManager.Themes.LIGHT; } else { Tema = MaterialSkinManager.Themes.DARK; } radek = cteni.ReadLine().Split(':'); Prezdivka = radek[1].Trim(); } }
public void SetUiTheme(MaterialSkinManager.Themes theme) { MaterialSkinManager.Theme = theme; }
public void Load() { string[] files = Directory.GetFiles(".", "-profile.ggLoL"); if (files.Length > 1) { // TO DO -> Option to take a Info from Users (More than 1) string users = ""; foreach (string i in files) { users += " | " + i.Replace("-profile.ggLoL", ""); } MessageBox.Show("Users: " + users); } else if (files.Length == 1) { string fileName = files[0]; if (!File.Exists(fileName)) { MessageBox.Show("Error with file " + fileName); } else { try { StreamReader reader = new StreamReader(fileName); // User Info this.name = reader.ReadLine(); this.password = reader.ReadLine(); this.email = reader.ReadLine(); this.nick = reader.ReadLine(); this.verify = reader.ReadLine().Split(':')[1] == "0" ? false : true; // Colors and Theme int count = 0; string coloursSave = reader.ReadLine(); Primary[] colour = new Primary[3]; foreach (string i in coloursSave.Split('|')) { // TO DO i.Split(':')[1]; count++; } colour[0] = Primary.BlueGrey800; colour[1] = Primary.BlueGrey900; colour[2] = Primary.BlueGrey900; Accent accent = Accent.LightBlue700; TextShade shade = TextShade.WHITE; string accentSave = reader.ReadLine(); foreach (string i in accentSave.Split('|')) { // TO DO i.Split(':')[1]; } string themeSave = reader.ReadLine(); MaterialSkinManager.Themes theme = themeSave.Split(':')[1] == MaterialSkinManager.Themes.LIGHT.ToString() ? MaterialSkinManager.Themes.LIGHT : MaterialSkinManager.Themes.DARK; ggLoL lol = new ggLoL(theme, colour[0], colour[1], colour[2], accent, shade); reader.Close(); } catch (PathTooLongException e) { MessageBox.Show(e.Message); } catch (FileNotFoundException e) { MessageBox.Show(e.Message); } catch (IOException e) { MessageBox.Show(e.Message); } catch (Exception e) { MessageBox.Show(e.Message); } } } }