Inheritance: System.Windows.Forms.Form, IUserInterface
 internal SetPrintAreaDialog(MainFrame mainFrame, Controller controller, PrintAreaKind printAreaKind)
 {
     InitializeComponent();
     this.mainFrame = mainFrame;
     this.controller = controller;
     this.printAreaKind = printAreaKind;
     this.printArea = PrintArea.DefaultPrintArea;
 }
Example #2
0
        // 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;
        }
Example #3
0
        // 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();
                }
            }
        }
Example #4
0
        // 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.
        }
Example #5
0
        // 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.
        }
Example #6
0
        // 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.
        }