示例#1
0
文件: MainForm.cs 项目: Menaver/Woret
        /// <summary>
        /// Gets all health state parameters from current 
        /// user setting or gotten state and puts to the form
        /// </summary>
        private void UpdateFormHealthState(HealthState state = null)
        {
            if (state == null)
            {
                // getting of health state parameters from user settings

                todoToolStripMenuItem.Checked = UserSettings.GetInstance().Tasks.Count > 0;

                healthComboBox.Text = UserSettings.GetInstance().HealthState.StateName;

                workTimeNumericUpDown.Maximum = UserSettings.GetInstance().HealthState.MaxWorkTime;
                workTimeNumericUpDown.Minimum = UserSettings.GetInstance().HealthState.MinWorkTime;
                workTimeNumericUpDown.Value = UserSettings.GetInstance().HealthState.WorkTime;

                restTimeNumericUpDown.Maximum = UserSettings.GetInstance().HealthState.MaxRestTime;
                restTimeNumericUpDown.Minimum = UserSettings.GetInstance().HealthState.MinRestTime;
                restTimeNumericUpDown.Value = UserSettings.GetInstance().HealthState.RestTime;

                _bigRestTimeKoef = UserSettings.GetInstance().HealthState.BigRestTimeKoef;

                BackColor = Color.FromName(UserSettings.GetInstance().HealthState.HealthColor);
            }
            else
            {
                // getting of health state parameters from gotten item

                workTimeNumericUpDown.Maximum = state.MaxWorkTime;
                workTimeNumericUpDown.Minimum = state.MinWorkTime;
                workTimeNumericUpDown.Value = state.WorkTime;

                restTimeNumericUpDown.Maximum = state.MaxRestTime;
                restTimeNumericUpDown.Minimum = state.MinRestTime;
                restTimeNumericUpDown.Value = state.RestTime;

                _bigRestTimeKoef = state.BigRestTimeKoef;

                BackColor = Color.FromName(state.HealthColor);
            }
        }
示例#2
0
 private UserSettings()
 {
     HealthState = new HealthState();
     Tasks = new List<string>();
 }