////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        protected virtual void OnClosed(WindowClosedEventArgs e)
        {
            if (Closed != null)
            {
                Closed.Invoke(this, e);
            }
        }
Exemple #2
0
 /// <summary>
 /// Event handler for the cancel creation dialog
 /// </summary>
 void Window_Closed(object sender, TomShane.Neoforce.Controls.WindowClosedEventArgs e)
 {
     if (((Window)sender).ModalResult == TomShane.Neoforce.Controls.ModalResult.Yes)
     {
         ServiceManager.StateManager.ChangeState(new TankListState());
     }
 }
Exemple #3
0
 /// <summary>
 /// After the yes button is presses, the tank modifications will be sent to the server
 /// </summary>
 /// <param name="obj">Not used</param>
 /// <param name="e">Not used</param>
 void Edit_Window_Closed(object sender, TomShane.Neoforce.Controls.WindowClosedEventArgs e)
 {
     if (((Window)sender).ModalResult == TomShane.Neoforce.Controls.ModalResult.Yes)
     {
         if (changesMade == true)
         {
             EditTank();
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// Event handler for when the user confirms a deletion
        /// </summary>
        void Window_Closed(object sender, TomShane.Neoforce.Controls.WindowClosedEventArgs e)
        {
            Window window = (Window)sender;

            if (window.ModalResult == TomShane.Neoforce.Controls.ModalResult.Yes)
            {
                try
                {
                    string tankName = form.List[form.SelectedIndex].ToString();
                    bool   result   = ServiceManager.Echelon.DeleteTank(tankName);

                    if (result)
                    {
                        MessageBox.Show(ServiceManager.Game.Manager,
                                        MessageBox.MessageBoxType.OKAY,
                                        String.Format("{0} was deleted.", tankName),
                                        "Successful.");
                    }
                    else
                    {
                        MessageBox.Show(ServiceManager.Game.Manager,
                                        MessageBox.MessageBoxType.ERROR,
                                        "An unknown error prevented the tank from being deleted.",
                                        "Couldn't delete the tank.");
                    }

                    RefreshTankList();

                    if (form.List.Count > 0)
                    {
                        form.SelectedIndex = 0;
                    }
                }
                catch (Exceptions.BadInformationException ex)
                {
                    MessageBox.Show(ServiceManager.Game.Manager,
                                    MessageBox.MessageBoxType.ERROR, ex.reason, "Error!");
                }
                catch (Exceptions.PermissionDeniedException ex)
                {
                    MessageBox.Show(ServiceManager.Game.Manager,
                                    MessageBox.MessageBoxType.ERROR, ex.reason, "Error!");
                }
            }
        }
Exemple #5
0
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        private void closeDialog_Closed(object sender, WindowClosedEventArgs e)
        {
            if ((sender as Dialog).ModalResult == ModalResult.Yes)
            {
                Exit();
            }
            else
            {
                exit = false;
                exitDialog.Closed -= closeDialog_Closed;
                exitDialog.Dispose();
                exitDialog = null;
                if (mainWindow != null)
                {
                    mainWindow.Focused = true;
                }
            }
        }
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        public virtual void Close()
        {
            WindowClosingEventArgs ex = new WindowClosingEventArgs();

            OnClosing(ex);
            if (!ex.Cancel)
            {
                Manager.Input.KeyDown     -= Input_KeyDown;
                Manager.Input.GamePadDown -= Input_GamePadDown;
                Manager.ModalWindow        = lastModal;
                if (lastModal != null)
                {
                    lastModal.Focused = true;
                }
                Hide();
                WindowClosedEventArgs ev = new WindowClosedEventArgs();
                OnClosed(ev);

                if (ev.Dispose)
                {
                    this.Dispose();
                }
            }
        }
Exemple #7
0
 ////////////////////////////////////////////////////////////////////////////      
 ////////////////////////////////////////////////////////////////////////////      
 void WindowClosed(object sender, WindowClosedEventArgs e)
 {
     if (sender is TaskDialog)
       {
     btnTasks[0].Enabled = true;
     btnTasks[0].Focused = true;
       }
       else if (sender is TaskControls)
       {
     btnTasks[1].Enabled = true;
     btnTasks[1].Focused = true;
       }
       else if (sender is TaskAutoScroll)
       {
     btnTasks[2].Enabled = true;
     btnTasks[2].Focused = true;
       }
       else if (sender is Window && (sender as Window).Name == "frmMain")
       {
     btnTasks[3].Enabled = true;
     btnTasks[3].Focused = true;
       }
       else if (sender is TaskEvents)
       {
     btnTasks[4].Enabled = true;
     btnTasks[4].Focused = true;
       }
       e.Dispose = true;
 }
Exemple #8
0
 /// <summary>
 /// Event handler for the creation successful dialog
 /// </summary>
 void Confirm_Closed(object sender, TomShane.Neoforce.Controls.WindowClosedEventArgs e)
 {
     VTankObject.TankAttributes selTank = new VTankObject.TankAttributes();
     selTank.name = form.TankName;
     ServiceManager.StateManager.ChangeState(new TankListState(selTank));
 }
		////////////////////////////////////////////////////////////////////////////      

		////////////////////////////////////////////////////////////////////////////      
		private void closeDialog_Closed(object sender, WindowClosedEventArgs e)
		{
			if ((sender as Dialog).ModalResult == ModalResult.Yes)
			{
				Exit();
			}
			else
			{
				exit = false;
				exitDialog.Closed -= closeDialog_Closed;
				exitDialog.Dispose();
				exitDialog = null;
				if (mainWindow != null) mainWindow.Focused = true;
			}
		}
 //////////////////////////////////////////////////////////////////////////// 
 ////////////////////////////////////////////////////////////////////////////    
 protected virtual void OnClosed(WindowClosedEventArgs e)
 {
     if (Closed != null) Closed.Invoke(this, e);
 }
        ////////////////////////////////////////////////////////////////////////////  
        ////////////////////////////////////////////////////////////////////////////
        public virtual void Close()
        {
            WindowClosingEventArgs ex = new WindowClosingEventArgs();
              OnClosing(ex);
              if (!ex.Cancel)
              {
            Manager.Input.KeyDown -= Input_KeyDown;
            Manager.Input.GamePadDown -= Input_GamePadDown;
            Manager.ModalWindow = lastModal;
            if (lastModal != null) lastModal.Focused = true;
            Hide();
            WindowClosedEventArgs ev = new WindowClosedEventArgs();
            OnClosed(ev);

            if (ev.Dispose)
            {
              this.Dispose();
            }
              }
        }
        void SelectMapSizeDialogClosed(object sender, WindowClosedEventArgs e)
        {
            if ((sender as Dialog).ModalResult == TomShane.Neoforce.Controls.ModalResult.Ok)
            {
                _startupSettings.MapSize = (sender as SelectMapSizeDialog).SelectetItem;

                InitMapTypeDialog();
            }

            e.Dispose = true;
        }
Exemple #13
0
 ////////////////////////////////////////////////////////////////////////////    
 ////////////////////////////////////////////////////////////////////////////    
 void win_Closed(object sender, WindowClosedEventArgs e)
 {
     e.Dispose = true;
 }
Exemple #14
0
 /// <summary>
 /// Event handler for the edit successful dialog
 /// </summary>
 void Confirm_Closed(object sender, TomShane.Neoforce.Controls.WindowClosedEventArgs e)
 {
     ServiceManager.StateManager.ChangeState(new TankListState(tank));
 }
Exemple #15
0
        /// <summary>
        /// Handles the Dialog Closed event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void closeDialog_Closed(object sender, WindowClosedEventArgs e)
        {
            // Check dialog resule and see if we need to shut down.
            if ((sender as Dialog).ModalResult == ModalResult.Yes)
            {
                Exit();
            }

            // Unhook event handlers and dispose of the dialog.
            else
            {
                exit = false;
                exitDialog.Closed -= closeDialog_Closed;
                exitDialog.Dispose();
                exitDialog = null;
                if (mainWindow != null) mainWindow.Focused = true;
            }
        }
Exemple #16
0
 void ExitDlg_Closed(object sender, WindowClosedEventArgs e)
 {
     if (ExitDlg.ModalResult == ModalResult.Yes)
         ThisApp.Exit();
 }
        void SelectCivilizationDialogClosed(object sender, WindowClosedEventArgs e)
        {
            if ((sender as Dialog).ModalResult == TomShane.Neoforce.Controls.ModalResult.Ok)
            {
                _startupSettings.CivilizationName = (sender as SelectCivilizationDialog).SelectetItem;

                Dialog d = new Dialog(Manager);
                d.Description.Text = _startupSettings.ToString();
                d.Init();
                Manager.Add(d);
                d.Show();
            }

            e.Dispose = true;
        }
        void SelectDifficultyDialogClosed(object sender, WindowClosedEventArgs e)
        {
            if ((sender as Dialog).ModalResult == TomShane.Neoforce.Controls.ModalResult.Ok)
            {
                _startupSettings.Difficulty = (sender as SelectDifficultyDialog).SelectetItem;

                InitCivilizationDialog();
            }

            e.Dispose = true;
        }