PurplePen.InitialScreen.CreateNewEvent C# (CSharp) Method

CreateNewEvent() public method

public CreateNewEvent ( ) : void
return void
        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();
                }
            }
        }