/// <summary> /// Returns the one DemoApplicationContext. /// </summary> public static Spreadsheet_Window getAppContext() { if (appContext == null) { appContext = new Spreadsheet_Window(); } return(appContext); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Start an application context and run one form inside it Spreadsheet_Window appContext = Spreadsheet_Window.getAppContext(); appContext.RunForm(new SimpleSpreadsheetGUI()); Application.Run(appContext); }
/// <summary> /// Event when "File -> New" is clicked. /// </summary> /// <param name="sender">New Button</param> /// <param name="e">New Button click event</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. Spreadsheet_Window.getAppContext().RunForm(new SimpleSpreadsheetGUI()); }