Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Args = e.Args;

            CreateJumpList();

            // Make the main process appear connected to the update process
            // in the taskbar.
            try { SetCurrentProcessExplicitAppUserModelID(GlobalAssemblyInfo.AssemblyName); }
            catch { }

            AppointmentDatabase.Load();
            AppointmentDatabase.OnSaveCompletedEvent += AppointmentDatabase_OnSaveCompletedEvent;
            ContactDatabase.Load();
            ContactDatabase.OnSaveCompletedEvent += ContactDatabase_OnSaveCompletedEvent;
            TaskDatabase.Load();
            TaskDatabase.OnSaveCompletedEvent += TaskDatabase_OnSaveCompletedEvent;
            NoteDatabase.Load();
            NoteDatabase.OnSaveCompletedEvent += NoteDatabase_OnSaveCompletedEvent;
            SyncDatabase.Load();
            SyncDatabase.OnSaveCompletedEvent += SyncDatabase_OnSaveCompletedEvent;
            QuoteDatabase.Load();
            QuoteDatabase.OnSaveCompletedEvent += QuoteDatabase_OnSaveCompletedEvent;

            ThemeHelpers.UpdateTheme(true);

            MainWindow mainWindow = new MainWindow();

            mainWindow.ContentRendered += mainWindow_ContentRendered;
            mainWindow.Show();

            SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
            SystemEvents.TimeChanged           += SystemEvents_TimeChanged;

            if (BackstageEvents.StaticUpdater == null)
            {
                BackstageEvents.StaticUpdater = new BackstageEvents();
            }

            BackstageEvents.StaticUpdater.OnForceUpdateEvent     += StaticUpdater_OnForceUpdateEvent;
            BackstageEvents.StaticUpdater.OnThemeChangedEvent    += StaticUpdater_OnThemeChangedEvent;
            BackstageEvents.StaticUpdater.OnExportEvent          += StaticUpdater_OnExportEvent;
            BackstageEvents.StaticUpdater.OnHelpEvent            += StaticUpdater_OnHelpEvent;
            BackstageEvents.StaticUpdater.OnDocumentRequestEvent += StaticUpdater_OnDocumentRequestEvent;
            BackstageEvents.StaticUpdater.OnPrintStartedEvent    += StaticUpdater_OnPrintStartedEvent;
            BackstageEvents.StaticUpdater.OnImportEvent          += StaticUpdater_OnImportEvent;
            BackstageEvents.StaticUpdater.OnQuotesChangedEvent   += StaticUpdater_OnQuotesChangedEvent;
        }