Exemplo n.º 1
0
        } // 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
Exemplo n.º 2
0
 private void TowerInfoWindow_Closing(object sender, WindowClosingEventArgs e)
 {
     if (GamePlayScreen.TowerManager.SelectedTower == Tower)
     {
         GamePlayScreen.TowerManager.DeselectTower();
     }
 }
Exemplo n.º 3
0
    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);
        }
    }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 /// <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;
     }
 }
Exemplo n.º 6
0
    /// <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);
    }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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();
            }
        }
Exemplo n.º 9
0
        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;
            }
        }
Exemplo n.º 10
0
        } // Close

        #endregion

        #region On Closing, On Closed

        protected virtual void OnClosing(WindowClosingEventArgs e)
        {
            if (Closing != null) 
                Closing.Invoke(this, e);
        } // OnClosing
Exemplo n.º 11
0
 private void WindowClosing(object sender, WindowClosingEventArgs e)
 {
     //e.Cancel = true;
 }
Exemplo n.º 12
0
 /// <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;
 }
Exemplo n.º 13
0
		void WindowClosing(object sender, WindowClosingEventArgs e) {
			//e.Cancel = true; 
		}
Exemplo n.º 14
0
		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;
		}