public ConfigurationWindow() { InitializeComponent(); missionsData.ItemsSource = missionMonitor()?.missions; MissionMonitorConfiguration configuration = MissionMonitorConfiguration.FromFile(); missionWarningInt.Text = configuration.missionWarning?.ToString(CultureInfo.InvariantCulture); }
public ConfigurationWindow() { InitializeComponent(); monitor = ((MissionMonitor)EDDI.Instance.ObtainMonitor("Mission monitor")); missionsData.ItemsSource = monitor.missions; MissionMonitorConfiguration configuration = MissionMonitorConfiguration.FromFile(); missionWarningInt.Text = configuration.missionWarning?.ToString(CultureInfo.InvariantCulture); }
private void warningChanged(object sender, TextChangedEventArgs e) { MissionMonitorConfiguration configuration = MissionMonitorConfiguration.FromFile(); try { int?warning = string.IsNullOrWhiteSpace(missionWarningInt.Text) ? 60 : Convert.ToInt32(missionWarningInt.Text, CultureInfo.InvariantCulture); ((MissionMonitor)EDDI.Instance.ObtainMonitor("Mission monitor")).missionWarning = warning; configuration.missionWarning = warning; configuration.ToFile(); } catch { // Bad user input; ignore it } }