/// <summary>
 /// Загрузить настройки
 /// </summary>
 private void LoadConfig()
 {
     if (File.Exists(ConfigFilePath))
     {
         string json = File.ReadAllText(ConfigFilePath);
         Config.UserSettings = JsonConvert.DeserializeObject <Dictionary <int, SingleUserConfig> >(json);
         int currUserId = AppState.CurrentUser.Id;
         singleUserConfig = Config.UserSettings[currUserId];
         UpdateComponents(singleUserConfig);
     }
 }
Beispiel #2
0
 /// <summary>
 ///  Обновляет компоненты на форме
 /// </summary>
 private void UpdateComponents(SingleUserConfig config)
 {
     // Цвет фона
     buttonBackColor.BackColor = Color.FromArgb(config.BackColor.R,
                                                config.BackColor.G,
                                                config.BackColor.B);
     // Цвет текста
     buttonFontColor.BackColor = Color.FromArgb(config.FontColor.R,
                                                config.FontColor.G,
                                                config.FontColor.B);
     // Шрифт
     // var FontFamily = new FontFamily(config.MyFont.Name);
     textBoxFont.Text = $"{config.MyFont.Name}, " +
                        $"{config.MyFont.Style}, " +
                        $"{config.MyFont.EmSize}";
 }
 /// <summary>
 ///  Обновляет компоненты на форме
 /// </summary>
 private void UpdateComponents(SingleUserConfig config)
 {
     // Цвет фона
     this.BackColor = Color.FromArgb(config.BackColor.R,
                                     config.BackColor.G,
                                     config.BackColor.B);
     // Цвет текста
     this.ForeColor = Color.FromArgb(config.FontColor.R,
                                     config.FontColor.G,
                                     config.FontColor.B);
     // Шрифт
     if (config.MyFont.Name != null)
     {
         var FontFamily = new FontFamily(config.MyFont.Name);
         this.Font = new Font(FontFamily,
                              config.MyFont.EmSize,
                              config.MyFont.Style);
     }
 }
Beispiel #4
0
 public ConfigForm(UserForm userForm)
 {
     this.userForm = userForm;
     config        = userForm.singleUserConfig;
     InitializeComponent();
 }