} // ShowModal #endregion #region Close /// <summary> /// Close /// </summary> public virtual void Close() { // Raise on closing event. WindowClosingEventArgs ex = new WindowClosingEventArgs(); OnClosing(ex); // If an event does not deny the closing... if (!ex.Cancel) { // Remove the event link to prevent garbage. UserInterfaceManager.InputSystem.KeyDown -= InputKeyDown; // Restore previous modal window. UserInterfaceManager.ModalWindow = lastModal; if (lastModal != null) lastModal.Focused = true; else UserInterfaceManager.FocusedControl = null; Hide(); // Raise on closed event. WindowClosedEventArgs ev = new WindowClosedEventArgs(); OnClosed(ev); // If an event does not change the dispose property. if (ev.Dispose) Dispose(); } } // Close
private void TowerInfoWindow_Closing(object sender, WindowClosingEventArgs e) { if (GamePlayScreen.TowerManager.SelectedTower == Tower) { GamePlayScreen.TowerManager.DeselectTower(); } }
protected void OnWindowClosing(bool IsChildWindow, ref bool Cancel) { EventHandler <WindowClosingEventArgs> h = WindowClosing; WindowClosingEventArgs args = new WindowClosingEventArgs(IsChildWindow, ref Cancel); if (null != h) { args.Cancel = true; h(this, args); } }
private void msg_Closed(object sender, WindowClosingEventArgs e) { if (e.Handled == true) { return; } Control wnd = ScreenManager.MainWindow.EnableClientControl("Account Login"); wnd.BringToFront(); mUsername.Focused = true; // re-focus e.Handled = true; }
/// <summary> /// Called when a window is being closed, you can continue to close it, or cancel the close and do something else /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void WindowClosing(object sender, WindowClosingEventArgs e) { if (sender is TaskLauncher) { InitMainScreen(); } if (sender is TaskProfile && Game.CurrentGameState == Game.GameState.HomeLoggedOn) { startPlanet.Enabled = true; closingtb = true; } }
/// <inheritdoc /> public virtual bool OnWindowClosing(IDockWindow?window) { var canClose = window?.OnClose() ?? true; var eventArgs = new WindowClosingEventArgs(window) { Cancel = !canClose }; WindowClosing?.Invoke(this, eventArgs); return(!eventArgs.Cancel); }
private void LogicWindowClosed(WindowClosingEventArgs args) { if (args != null) { args.Cancel = true; } _logicWindow.Hide(); // Update the logic within the currently selected node _logicWindow.GetInstance(GetCurrentlySelectedNode()); EnableWorld(true); }
private async void MainWindow_Closing(object sender, WindowClosingEventArgs e) { ContentDialog contentDialog = new ContentDialog(); contentDialog.Content = "Close it?"; contentDialog.XamlRoot = this.Content.XamlRoot; contentDialog.PrimaryButtonText = "Yes"; contentDialog.CloseButtonText = "No"; contentDialog.IsPrimaryButtonEnabled = true; var r = await contentDialog.ShowAsync(); if (r == ContentDialogResult.Primary) { // Cancel the close event e.TryCancel(); } }
private void CloseCommandExecute(object obj) { string closingtabs = ""; WindowClosingEventArgs windowClosingEventArgs = obj as WindowClosingEventArgs; CloseTabEventArgs closeTabEventArgs = obj as CloseTabEventArgs; List <object> closingItems = null; if (closeTabEventArgs != null) { closingItems = closeTabEventArgs.ClosingTabItems.Select(a => a).ToList(); } MessageBoxResult result = MessageBox.Show("Do you want to close the tabs? ", "Closing Tabs", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { if (closeTabEventArgs != null && closingItems != null) { for (int i = 0; i < closingItems.Count; i++) { TabItemExt tabitem = closingItems[i] as TabItemExt; if (tabitem.Content != null && (tabitem.Content as ContentPresenter) != null) { ContentPresenter presenter = tabitem.Content as ContentPresenter; if (presenter != null && presenter.Content != null) { closingtabs = closingtabs + "\n\t" + DockingManager.GetHeader(presenter.Content as DependencyObject); } } } closingItems.Clear(); } else { closingtabs = closingtabs + "\n\t" + DockingManager.GetHeader(windowClosingEventArgs.TargetItem); } this.Text = this.Text + "Closed Tabs" + " : " + closingtabs + "\n"; } else if (result == MessageBoxResult.No) { (obj as CloseTabEventArgs).Cancel = true; } }
} // Close #endregion #region On Closing, On Closed protected virtual void OnClosing(WindowClosingEventArgs e) { if (Closing != null) Closing.Invoke(this, e); } // OnClosing
private void WindowClosing(object sender, WindowClosingEventArgs e) { //e.Cancel = true; }
/// <summary> /// This method invokes when docking manager window is closing. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void DockingManager_WindowClosing_1(object sender, WindowClosingEventArgs e) { e.Cancel = true; (this.DataContext as DiagramBuilderVM).SelectedDiagram.EnableSizePosition = false; }
void WindowClosing(object sender, WindowClosingEventArgs e) { //e.Cancel = true; }
private void msg_Closed(object sender, WindowClosingEventArgs e) { if (e.Handled == true) return; Control wnd = ScreenManager.MainWindow.EnableClientControl("Account Login"); wnd.BringToFront(); mUsername.Focused = true; // re-focus e.Handled = true; }