internal SetPrintAreaDialog(MainFrame mainFrame, Controller controller, PrintAreaKind printAreaKind) { InitializeComponent(); this.mainFrame = mainFrame; this.controller = controller; this.printAreaKind = printAreaKind; this.printArea = PrintArea.DefaultPrintArea; }
// Attempt to load file from a command line file. Return true on success. static bool LoadCommandLineFile(string filename) { MainFrame mainFrame = new MainFrame(); Controller controller = new Controller(mainFrame); if (!controller.LoadInitialFile(filename, true)) { // File didn't load. // Go back and show the initial screen again. mainFrame.Dispose(); return false; } // Start the UI mainFrame.Show(); return true; }
// Create new event was selected. public void CreateNewEvent() { NewEventWizard wizard = new NewEventWizard(); DialogResult result = wizard.ShowDialog(this); if (result == DialogResult.Cancel) { // User cancelled // Go back and show the initial screen again. Show(); Activate(); return; } else { // Start the UI MainFrame mainFrame = new MainFrame(); Controller controller = new Controller(mainFrame); // Create the new event. if (controller.InitialNewEvent(wizard.CreateEventInfo)) { // success // show the main frame with the new event. mainFrame.Show(); mainFrame.Activate(); // The initial screen is over and out. Dispose(); } else { // Failure: Go back and show the initial screen again. mainFrame.Dispose(); Show(); Activate(); } } }
// Open sample event was selected public void OpenSampleEvent() { MainFrame mainFrame = new MainFrame(); Controller controller = new Controller(mainFrame); if (!controller.LoadInitialFile(SampleEventFileName(), false)) { // Don't set sample event as the last loaded file. // File didn't load. // Go back and show the initial screen again. mainFrame.Dispose(); Activate(); return; } // Set the description language to the UI language. string langId = Util.CurrentLangName(); if (controller.HasDescriptionLanguage(langId)) { controller.SetDescriptionLanguage(langId); controller.MarkClean(); } // Start the UI mainFrame.Show(); mainFrame.Activate(); Dispose(); // The initial screen is over and out. }
// Open existing event was selected. public void OpenLastViewedEvent() { MainFrame mainFrame = new MainFrame(); Controller controller = new Controller(mainFrame); if (!controller.LoadInitialFile(Settings.Default.LastLoadedFile, true)) { // User cancelled or the file didn't load. // Go back and show the initial screen again. mainFrame.Dispose(); Activate(); return; } // Start the UI mainFrame.Show(); mainFrame.Activate(); Dispose(); // The initial screen is over and out. }
// Open existing event was selected. public void OpenExistingEvent() { MainFrame mainFrame = new MainFrame(); Controller controller = new Controller(mainFrame); string fileName = mainFrame.GetOpenFileName(); if (fileName == null || ! controller.LoadInitialFile(fileName, true)) { // User cancelled or the file didn't load. // Go back and show the initial screen again. mainFrame.Dispose(); Activate(); return; } // Start the UI mainFrame.Show(); mainFrame.Activate(); Dispose(); // The initial screen is over and out. }