private static void Config_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(Config.Transparent)) { DispatcherUI.Invoke(delegate { Windows.ReopenMain(); }); } PluginUI.SaveConfiguration(Config); }
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 { Windows.Close(); Models.Dispose(); }); DispatcherUI.InvokeShutdown(); } return(0); } catch (Exception ex) { ShowExceptionMessage(ex); return(1); } finally { Config = null; DispatcherUI = null; IsExiting = false; } }