Esempio n. 1
0
        private static void Config_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(Config.Transparent))
            {
                DispatcherUI.Invoke(delegate
                {
                    Windows.ReopenMain();
                });
            }

            PluginUI.SaveConfiguration(Config);
        }
Esempio n. 2
0
        public static int Exit()
        {
            IsExiting = true;

            if (Config != null)
            {
                PluginUI.SaveConfiguration(Config);

                try { Config.PropertyChanged -= Config_PropertyChanged; }
                catch (Exception) { }
            }

            Properties.Settings.Default.Save();

            try
            {
                if (DispatcherUI != null)
                {
                    DispatcherUI.Invoke(delegate
                    {
                        Models.Dispose();
                        Windows.Close();
                    });
                    DispatcherUI.InvokeShutdown();
                }

                return(0);
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex);
                return(1);
            }
            finally
            {
                Config       = null;
                DispatcherUI = null;
                IsExiting    = false;
            }
        }