/// <summary> /// Clear things. /// </summary> private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (AppSettings.Current.General.ExitWhenClosed == null && !ForceExit) { e.Cancel = true; FramePop.Navigate(new ClosingPage(this)); return; } else if (AppSettings.Current.General.ExitWhenClosed == false && !ForceExit) { WindowState = WindowState.Minimized; Hide(); e.Cancel = true; return; } PlayController.Default?.Dispose(); LyricWindow.Dispose(); NotifyIcon.Dispose(); if (ConfigWindow == null || ConfigWindow.IsClosed) { return; } if (ConfigWindow.IsInitialized) { ConfigWindow.Close(); } }
/// <summary> /// Clear things. /// </summary> private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (AppSettings.Default.General.ExitWhenClosed == null && !_forceExit) { e.Cancel = true; var closingControl = new ClosingControl(); FrontDialogOverlay.ShowContent(closingControl, DialogOptionFactory.ClosingOptions, (obj, arg) => { if (closingControl.AsDefault.IsChecked == true) { AppSettings.Default.General.ExitWhenClosed = closingControl.RadioMinimum.IsChecked != true; AppSettings.SaveDefault(); } if (closingControl.RadioMinimum.IsChecked == true) { Hide(); } else { _forceExit = true; Close(); } }); return; } if (AppSettings.Default.General.ExitWhenClosed == false && !_forceExit) { WindowState = WindowState.Minimized; GetCurrentFirst <MiniWindow>()?.Close(); Hide(); e.Cancel = true; return; } if (_disposed) { return; } e.Cancel = true; GetCurrentFirst <MiniWindow>()?.Close(); LyricWindow.Dispose(); NotifyIcon.Dispose(); if (ConfigWindow != null && !ConfigWindow.IsClosed && ConfigWindow.IsInitialized) { ConfigWindow.Close(); } if (_controller != null) { await _controller.DisposeAsync().ConfigureAwait(false); } _disposed = true; await Task.CompletedTask.ConfigureAwait(false); Execute.ToUiThread(ForceClose); }
/// <summary> /// Clear things. /// </summary> private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (AppSettings.Default.General.ExitWhenClosed == null && !ForceExit) { e.Cancel = true; var closingControl = new ClosingControl(); FrontDialogOverlay.ShowContent(closingControl, DialogOptionFactory.ClosingOptions, (obj, arg) => { if (closingControl.AsDefault.IsChecked == true) { AppSettings.Default.General.ExitWhenClosed = closingControl.RadioMinimum.IsChecked != true; AppSettings.SaveDefault(); } if (closingControl.RadioMinimum.IsChecked == true) { Hide(); } else { ForceExit = true; Close(); } }); return; } if (AppSettings.Default.General.ExitWhenClosed == false && !ForceExit) { WindowState = WindowState.Minimized; GetCurrentFirst <MiniWindow>()?.Close(); Hide(); e.Cancel = true; return; } GetCurrentFirst <MiniWindow>()?.Close(); PlayController.Default?.Dispose(); LyricWindow.Dispose(); NotifyIcon.Dispose(); if (ConfigWindow != null && !ConfigWindow.IsClosed && ConfigWindow.IsInitialized) { ConfigWindow.Close(); } }