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); }
/// <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."); } }
/// <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()); }
/// <summary> /// Opens new document /// </summary> private void newCtrlNToolStripMenuItem_Click(object sender, EventArgs e) { DemoApplicationContext.getAppContext().RunForm(new SpreadsheetGUI()); }
/// <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()); }