/// <summary> /// Begins controlling window. /// </summary> public Controller(AnalysisWindow window) { this.window = window; window.FileChosenEvent += HandleFileChosen; window.CloseEvent += HandleClose; window.NewEvent += HandleNew; window.CountEvent += HandleCount; }
/// <summary> /// Runs a form in this application context /// </summary> public void RunNew() { // Create the window AnalysisWindow window = new AnalysisWindow(); // One more form is running windowCount++; // When this form closes, we want to find out window.FormClosed += (o, e) => { if (--windowCount <= 0) { ExitThread(); } }; // Run the form window.Show(); }