/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); InitializeServices(); ExtensionManager = new ExtensionManager(); }
private void LoadConfiguration() { try { AlarmWorkflow.Windows.UI.Properties.Settings.Default.Reload(); Configuration = new UIConfiguration(); ExtensionManager = new ExtensionManager(); Logger.Instance.LogFormat(LogType.Info, this, AlarmWorkflow.Windows.UI.Properties.Resources.UIConfigurationLoaded); } catch (EndpointNotFoundException ex) { UIUtilities.ShowError(AlarmWorkflow.Windows.UI.Properties.Resources.UICannotStartWithoutConnectionError); Logger.Instance.LogException(this, ex); Environment.Exit(1); } catch (Exception ex) { Logger.Instance.LogFormat(LogType.Error, this, AlarmWorkflow.Windows.UI.Properties.Resources.UIConfigurationLoadError); Logger.Instance.LogException(this, ex); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { if (_mutex == null) { return; } base.OnStartup(e); // Set shutdown mode to explicit to allow our application to run even if there are no windows open anymore. ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; _startedDate = DateTime.UtcNow; // Create taskbar icon _taskbarIcon = new TaskbarIcon(); _taskbarIcon.IconSource = new BitmapImage(this.GetPackUri("Images/Taskbar.ico")); _taskbarIcon.ToolTipText = "AlarmWorkflowUI"; _taskbarIcon.ContextMenu = new System.Windows.Controls.ContextMenu(); _taskbarIcon.ContextMenu.Items.Add(new MenuItem() { Header = "Anwendung schließen", Command = new RelayCommand(LeftClickCommand_Execute), }); // Create timer with a custom interval from configuration _timer = new System.Timers.Timer(Configuration.OperationFetchingArguments.Interval); _timer.Elapsed += new ElapsedEventHandler(Timer_Elapsed); _timer.Start(); InitializeServices(); ExtensionManager = new ExtensionManager(); }