public async void ReadThemeAsync() { try { List <ProgramTheme> themes; using (FileStream file = new FileStream($"{Directory.GetCurrentDirectory()}\\ThemeModel\\ThemeSettings.json", FileMode.OpenOrCreate)) { DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(List <ProgramTheme>)); themes = jsonSerializer.ReadObject(file) as List <ProgramTheme>; } if (themes.Count(x => x.UserID == userID) > 0) { ProgramTheme ThemeOBJ = themes.Find(x => x.UserID == userID); ChangeNonMetroControls(ThemeOBJ); ChangeMetroControls(ThemeOBJ); Refresh(); } } catch (Exception ex) { MetroMessageBox.Show(this, "Произошла ошибка при дисериализации: \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async void ChangeMetroControls(ProgramTheme obj) { this.Theme = _currentThemeStyle; tabHelp.Theme = _currentThemeStyle; tabHelp.Controls.OfType <MetroTabPage>() .ToList() .ForEach(x => x.Theme = _currentThemeStyle); }
public void ChangeNonMetroControls(ProgramTheme OBJ) { groupBoxHEAD.GradientBottomLeft = OBJ.BottomLeft; groupBoxHEAD.GradientBottomRight = OBJ.BottomRight; groupBoxHEAD.GradientTopLeft = OBJ.TopLeft; groupBoxHEAD.GradientTopRight = OBJ.TopRight; groupBoxHEAD.Controls.OfType <Label>().Select(x => x.ForeColor = OBJ.FontColor).ToList(); groupBoxHEAD.Refresh(); }
public void ChangeNonMetroControls(ProgramTheme OBJ) { switchTheme.Checked = OBJ.Theme == ETheme.Dark; pictureBoxPROFILE.BackColor = OBJ.Theme == ETheme.Dark ? Color.DimGray : Color.WhiteSmoke; labelChangeTheme.ForeColor = OBJ.Theme == ETheme.Dark ? Color.Black : Color.White; labelChangeTheme.Text = OBJ.Theme == ETheme.Dark ? "Dark theme" : "Light theme"; circlePictureBoxBL.BackColor = OBJ.BottomLeft; circlePictureBoxTL.BackColor = OBJ.TopLeft; circlePictureBoxBR.BackColor = OBJ.BottomRight; circlePictureBoxTR.BackColor = OBJ.TopRight; labelFontColor.LinkColor = OBJ.FontColor; }
public void ChangeMetroControls(ProgramTheme OBJ) { Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark; linkLabelCHANGEprofilePIC.Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark; }
public async void ChangeNonMetroControls(ProgramTheme obj) { labelMainWindow.ForeColor = _currentThemeStyle == MetroThemeStyle.Light ? Color.Black : Color.White; labelOrderBasket.ForeColor = _currentThemeStyle == MetroThemeStyle.Light ? Color.Black : Color.White; labelProfile.ForeColor = _currentThemeStyle == MetroThemeStyle.Light ? Color.Black : Color.White; }
public void ChangeNonMetroControls(ProgramTheme obj) { panelHead.BackColor = obj.Theme == ETheme.Dark ? Color.FromArgb(17, 17, 17) : Color.White; Graphic.BackGroundColor = obj.Theme == ETheme.Dark ? Color.Black : Color.White; Graphic.LineColor = obj.Theme == ETheme.Dark ? Color.Orchid : Color.OrangeRed; }
public void ChangeMetroControls(ProgramTheme obj) { this.Theme = obj.Theme == ETheme.Dark ? MetroThemeStyle.Dark : MetroThemeStyle.Light; }
public void ChangeNonMetroControls(ProgramTheme OBJ) { labelYourOrder.BackColor = OBJ.Theme == ETheme.Light ? Color.AliceBlue : Color.MediumVioletRed; }
public void ChangeMetroControls(ProgramTheme OBJ) { Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark; tabControlPRODUCTs.Theme = OBJ.Theme == ETheme.Dark ? MetroThemeStyle.Dark : MetroThemeStyle.Light; metroLabelID.ForeColor = OBJ.Theme == ETheme.Light ? Color.Aquamarine : Color.Magenta; }
public void ChangeMetroControls(ProgramTheme OBJ) { Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark; }