Guest User

wyUpdate for MS Project

a guest
Feb 1st, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1.  public partial class Updater : Form {
  2.         public Updater() {
  3.             InitializeComponent();
  4.             automaticUpdater1.wyUpdateLocation = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, automaticUpdater1.wyUpdateLocation);
  5.            
  6.         }
  7.  
  8.         private void button1_Click(object sender, EventArgs e) {
  9.  
  10.             /*
  11.              * Due to the way the forms are set up between the Project application and the VSTO application, I need to
  12.              * wrap the file exit functionality in my own save prompt.  When one calls FileExit with no parameters it attempts to prompt the user to save.
  13.              * However, the form isn't accessible since this is a .ShowDialog window.  Switching to .Show introduced other
  14.              * problems (would manually have to switch windows to get to the save dialog).  Therefore, wrapping the exit
  15.              * code and manually handling the save dialog is how we have to go about closing the app.
  16.              */
  17.  
  18.             var dr = MessageBox.Show("Save?", "Save?", MessageBoxButtons.YesNoCancel);
  19.  
  20.             if (DialogResult.Yes == dr) {
  21.                 Controller.App.FileExit(Microsoft.Office.Interop.MSProject.PjSaveType.pjSave);
  22.             } else if (DialogResult.No == dr) {
  23.                 Controller.App.FileExit(Microsoft.Office.Interop.MSProject.PjSaveType.pjDoNotSave);
  24.             } else {
  25.                 //Cancel save/close
  26.             }
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment