// Open the settings window private void ShowSettings() { RefreshMainWindow(new List <Alarm>()); // Remove all the alarms from the screen Topmost = false; Mouse.OverrideCursor = null; // Use the default cursor when the settings window is opened StopListener(); var window = new SettingsWindow(AicSettings.Global); var result = window.ShowDialog(); if (result.HasValue && result.Value) { try { AicSettings.Global = AicSettings.Load(); } catch (Exception) { MessageBox.Show("Die neuen Einstellungen konnten nicht geladen werden. Bitte starten Sie das Programm neu.", "AIC", MessageBoxButton.OK, MessageBoxImage.Error); } } ApplySettings(); }
/// <summary> /// Initializes a new main window. /// </summary> public MainWindow() { InitializeComponent(); mStartTime = DateTime.Now; Log.GetInstance().IgnoreEqualLogMessages = true; Log.GetInstance().LogInformation("AIC started"); // Timer that turns the screen off if there is no alarm anymore mTurnScreenOffTimer = new DispatcherTimer(); mTurnScreenOffTimer.Tick += mTurnScreenOffTimer_Tick; try { AicSettings.Global = AicSettings.Load(); } catch { AicSettings.Global = new AicSettings(); ShowSettings(); } PrepareForDebug(); // This method is only called in DEBUG mode ApplySettings(); // Apply settings without data binding InfoCenterCtrl.LogInformation = Log.GetInstance().LogInformation; InfoCenterCtrl.LogWarning = Log.GetInstance().LogWarning; InfoCenterCtrl.LogError = Log.GetInstance().LogError; // Full screen mode if (AicSettings.Global.FullScreenMode) { Visibility = Visibility.Visible; WindowState = WindowState.Maximized; } else { Visibility = Visibility.Hidden; } // Multi alarm font size MultiAlarmLbl.FontSize = SystemParameters.PrimaryScreenHeight / 18; MultiAlarmPageLbl.FontSize = MultiAlarmLbl.FontSize; // Check system in a separate thread mCheckSystemWorker.DoWork += mCheckSystemWorker_DoWork; mCheckSystemWorker.RunWorkerCompleted += mCheckSystemWorker_RunWorkerCompleted; mCheckSystemWorker.RunWorkerAsync(); // One minute timer (checks the system) var oneMinuteTimer = new DispatcherTimer(); oneMinuteTimer.Interval = new TimeSpan(0, 1, 0); oneMinuteTimer.Tick += oneMinuteTimer_Tick; oneMinuteTimer.Start(); // Change alarm tab every x seconds mChangeTabTimer = new DispatcherTimer(); mChangeTabTimer.Interval = new TimeSpan(0, 0, AicSettings.Global.AlarmDisplayDuration); mChangeTabTimer.Tick += mChangeTabTimer_Tick; mChangeTabTimer.Start(); // Show new alarm for x seconds mNewAlarmTimer = new DispatcherTimer(); mNewAlarmTimer.Interval = new TimeSpan(0, 0, AicSettings.Global.NewAlarmDisplayDuration); mNewAlarmTimer.Tick += mNewAlarmTimer_Tick; //Thread.Sleep(200); // Show the splash screen some more time. Do not waste time! }