Example #1
0
 private void close_button_Click(object sender, RoutedEventArgs e)
 {
     if (view != null)
     {
         LeaveConfirm leaveconfirmwindow = new LeaveConfirm();
         leaveconfirmwindow.ShowDialog();
         if (leaveconfirmwindow.ReturnFlag() == 1)
         {
             this.Close();
         }
         else if (leaveconfirmwindow.ReturnFlag() == 2)
         {
             if (currentfilename != null)
             {
                 view.SaveAll(currentfilename);
             }
             this.Close();
         }
         else
         {
             leaveconfirmwindow.Close();
         }
     }
     else
     {
         this.Close();
     }
 }
Example #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (view != null)
     {
         LeaveConfirm leaveconfirmwindow = new LeaveConfirm();
         leaveconfirmwindow.ShowDialog();
         if (leaveconfirmwindow.ReturnFlag() == 1)
         {
             e.Cancel = false;
         }
         else if (leaveconfirmwindow.ReturnFlag() == 2)
         {
             if (currentfilename != null)
             {
                 view.SaveAll(currentfilename);
             }
             e.Cancel = false;
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         e.Cancel = false;
     }
 }