Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 public async void ChangeMetroControls(ProgramTheme obj)
 {
     this.Theme    = _currentThemeStyle;
     tabHelp.Theme = _currentThemeStyle;
     tabHelp.Controls.OfType <MetroTabPage>()
     .ToList()
     .ForEach(x => x.Theme = _currentThemeStyle);
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 public void ChangeMetroControls(ProgramTheme OBJ)
 {
     Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
     linkLabelCHANGEprofilePIC.Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 public void ChangeMetroControls(ProgramTheme obj)
 {
     this.Theme = obj.Theme == ETheme.Dark ? MetroThemeStyle.Dark : MetroThemeStyle.Light;
 }
Esempio n. 9
0
File: BIN.cs Progetto: Jeffeek/PCbuy
 public void ChangeNonMetroControls(ProgramTheme OBJ)
 {
     labelYourOrder.BackColor = OBJ.Theme == ETheme.Light ? Color.AliceBlue : Color.MediumVioletRed;
 }
Esempio n. 10
0
File: BIN.cs Progetto: Jeffeek/PCbuy
 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;
 }
Esempio n. 11
0
 public void ChangeMetroControls(ProgramTheme OBJ)
 {
     Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
 }