예제 #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);
            }
        }
예제 #2
0
 public async void ChangeMetroControls(ProgramTheme obj)
 {
     this.Theme    = _currentThemeStyle;
     tabHelp.Theme = _currentThemeStyle;
     tabHelp.Controls.OfType <MetroTabPage>()
     .ToList()
     .ForEach(x => x.Theme = _currentThemeStyle);
 }
예제 #3
0
파일: formUSER.cs 프로젝트: Jeffeek/PCbuy
 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();
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #8
0
 public void ChangeMetroControls(ProgramTheme obj)
 {
     this.Theme = obj.Theme == ETheme.Dark ? MetroThemeStyle.Dark : MetroThemeStyle.Light;
 }
예제 #9
0
파일: BIN.cs 프로젝트: Jeffeek/PCbuy
 public void ChangeNonMetroControls(ProgramTheme OBJ)
 {
     labelYourOrder.BackColor = OBJ.Theme == ETheme.Light ? Color.AliceBlue : Color.MediumVioletRed;
 }
예제 #10
0
파일: BIN.cs 프로젝트: 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;
 }
예제 #11
0
파일: formUSER.cs 프로젝트: Jeffeek/PCbuy
 public void ChangeMetroControls(ProgramTheme OBJ)
 {
     Theme = OBJ.Theme == ETheme.Light ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
 }