public Settings() { InitializeComponent(); setting = new Utilities.Settings(); try { DrillDuration = setting.GetValueOrDefault(Utilities.Settings.DrillDurationSettingKeyName, setting.DrillDurationSettingDefault); WarningDuration = setting.GetValueOrDefault(Utilities.Settings.WarningSettingKeyName, setting.WarningSettingDefault); ResetDuration = setting.GetValueOrDefault(Utilities.Settings.ResetSettingKeyName, setting.ResetSettingDefault); } catch (Exception e) { MessageBox.Show("Whoops, sorry something went wrong while loading your settings."); } }
public NewDrill() { InitializeComponent(); initialfeedbackBanter = new Random().Next(0, banter.Length); descTxtBox.Text = banter[initialfeedbackBanter]; Utilities.Settings set = new Utilities.Settings(); //init drill duration DrillDuration = set.GetValueOrDefault(Utilities.Settings.DrillDurationSettingKeyName, set.DrillDurationSettingDefault); DrillMaxDuration = TimeSpan.FromMinutes(5); DrillStepDuration = TimeSpan.FromSeconds(5); //init warning duration WarningDuration = set.GetValueOrDefault(Utilities.Settings.WarningSettingKeyName, set.WarningSettingDefault); WarningMaxDuration = TimeSpan.FromSeconds(30); WarningStepDuration = TimeSpan.FromSeconds(5); //init reset duration ResetDuration = set.GetValueOrDefault(Utilities.Settings.ResetSettingKeyName, set.ResetSettingDefault); ResetMaxDuration = TimeSpan.FromSeconds(55); ResetStepDuration = TimeSpan.FromSeconds(5); }