コード例 #1
0
ファイル: InitialScreen.cs プロジェクト: petergolde/PurplePen
        // 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();
                }
            }
        }
コード例 #2
0
ファイル: InitialScreen.cs プロジェクト: petergolde/PurplePen
        // 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.
        }
コード例 #3
0
ファイル: InitialScreen.cs プロジェクト: petergolde/PurplePen
        // 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.
        }
コード例 #4
0
ファイル: InitialScreen.cs プロジェクト: petergolde/PurplePen
        // 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.
        }