Esempio n. 1
0
        public MainWindow()
        {
            ControlsHelper.InitInvokeContext();
            // Make sure setting changes updates UI on the same thread as UI.
            var scheduler = ControlsHelper.MainTaskScheduler;

            SettingsManager.SetSynchronizingObject(scheduler);
            // Disable some functionality in Visual Studio Interface design mode.
            if (!ControlsHelper.IsDesignMode(this))
            {
                PreviewKeyDown += MainWindow_PreviewKeyDown;
                Closing        += MainWindow_Closing;
            }
            InitHelper.InitTimer(this, InitializeComponent);
            if (ControlsHelper.IsDesignMode(this))
            {
                return;
            }
            StartHelper.Initialize();
            InitiInterfaceUpdate();
            // Check if app version changed.
            var o          = SettingsManager.Options;
            var appVersion = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().Version.ToString();

            AppVersionChanged = o.AppVersion != appVersion;
            o.AppVersion      = appVersion;
        }
Esempio n. 2
0
 private void Window_Unloaded(object sender, RoutedEventArgs e)
 {
     // Cleanup references which prevents disposal.
     StartHelper.OnClose   -= StartHelper_OnClose;
     StartHelper.OnRestore -= StartHelper_OnRestore;
     SettingsManager.Current.SettingChanged      -= Current_SettingChanged;
     SettingsManager.Summaries.Items.ListChanged -= Summaries_ListChanged;
     SettingsManager.Current.ConfigLoaded        -= Current_ConfigLoaded;
     Global.DHelper.DevicesUpdated   -= DHelper_DevicesUpdated;
     Global.DHelper.UpdateCompleted  -= DHelper_UpdateCompleted;
     Global.DHelper.FrequencyUpdated -= DHelper_FrequencyUpdated;
     Global.DHelper.StatesRetrieved  -= DHelper_StatesRetrieved;
     Global.DHelper.XInputReloaded   -= DHelper_XInputReloaded;
     SettingsManager.Current.NotifySettingsStatus = null;
     SettingsManager.SetSynchronizingObject(null);
     IssuesPanel.IsSuspended     = null;
     IssuesPanel.CheckCompleted -= IssuesPanel_CheckCompleted;
     UpdateTimer.Elapsed        -= UpdateTimer_Elapsed;
     UpdateTimer.Dispose();
     SettingsTimer.Elapsed -= SettingsTimer_Elapsed;
     SettingsTimer.Dispose();
     CleanStatusTimer.Elapsed -= CleanStatusTimer_Elapsed;
     CleanStatusTimer.Dispose();
     StartHelper.Dispose();
     DisposeUpdateForm();
     DisposeInterfaceUpdate();
     CollectGarbage();
 }