Ejemplo n.º 1
0
        public MainWindow()
        {
            if (AlreadyRunning())
            {
                MessageBox.Show(Wsapm.Resources.Wsapm.MainWindow_AppAlreadyRunning, Wsapm.Resources.Wsapm.MainWindow_Title, MessageBoxButton.OK, MessageBoxImage.Information);
                App.Current.Shutdown();
                return;
            }

            ParseArgs();

            try
            {
                this.settingsLock           = new object();
                this.logManager             = new LogManager(WsapmTools.GetCommonApplicationDataFolder(), WsapmConstants.WsapmApplicationLogFile);
                this.logManager.LogChanged += logManager_LogChanged;

                InitializeComponent();

                this.serviceManager  = new ServiceManager();
                this.settingsManager = new SettingsManager();

                lock (this.settingsLock)
                {
                    this.currentSettings = this.settingsManager.LoadSettings();
                }

                this.logManager.Start();

                if (this.textBoxLog != null && this.scrollViewerLog != null)
                {
                    this.textBoxLog.Text = this.logManager.Log; // Load current log manually for the first time.
                    this.scrollViewerLog.ScrollToEnd();
                }

                this.temporaryUptimeManager = new TemporaryUptimeManager();
            }
            catch (Exception ex)
            {
                UnhandledExceptionManager.HandleException(ex);
            }
        }
Ejemplo n.º 2
0
 void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     UnhandledExceptionManager.HandleExceptionAndShutDownApplication(e.Exception);
 }