Example #1
0
 /// <summary>
 /// Returns the one DemoApplicationContext.
 /// </summary>
 public static DemoApplicationContext getAppContext()
 {
     if (appContext == null)
     {
         appContext = new DemoApplicationContext();
     }
     return(appContext);
 }
Example #2
0
 /// <summary>
 /// Returns the one DemoApplicationContext.
 /// </summary>
 public static DemoApplicationContext getAppContext()
 {
     if (appContext == null)
     {
         appContext = new DemoApplicationContext();
     }
     return appContext;
 }
Example #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Start an application context and run one form inside it
            DemoApplicationContext appContext = DemoApplicationContext.getAppContext();

            appContext.RunForm(new Form1(null));
            Application.Run(appContext);
        }
Example #4
0
 /// <summary>
 /// Opens a file dialog, that when selected, will open an existing file in a new window.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void openNewFileDialog1_FileOk(object sender, CancelEventArgs e)
 {
     try
     {
         string filePath = openNewFileDialog1.FileName;
         DemoApplicationContext.getAppContext().RunForm(new Form1(filePath));
     }
     catch
     {
         MessageBox.Show("There was an error opening the file.  Please make sure that the filepath is correct, and that the file is a valid spreadsheet file.");
     }
 }
Example #5
0
 /// <summary>
 /// Deals with the new menu.  Opens a new spreadsheet while keeping the previous spreadsheet
 /// open
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     // Tell the application context to run the form on the same
     // thread as the other forms.
     DemoApplicationContext.getAppContext().RunForm(new SpreadsheetGUI());
 }
Example #6
0
 /// <summary>
 /// Opens new document
 /// </summary>
 private void newCtrlNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DemoApplicationContext.getAppContext().RunForm(new SpreadsheetGUI());
 }
Example #7
0
 /// <summary>
 /// Opening the help menu as a separate form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void viewHelpToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DemoApplicationContext.getAppContext().RunForm(new HelpMenu());
 }