Пример #1
0
        private void ShowIntroDialog()
        {
            IntroDialog id = new IntroDialog(vc.IsAutosavePresent());

            id.ShowDialog(this);

            switch (id.Start)
            {
            case IntroDialog.StartupType.NewTemplate:
                vc.CreateNewTemplate();
                tbcMain.SelectedIndex = TBI_TEMPLATE;
                break;

            case IntroDialog.StartupType.LoadTemplate:
                vc.ShowLoadTemplate();
                tbcMain.SelectedIndex = TBI_TEMPLATE;
                break;

            case IntroDialog.StartupType.LoadBackupTemplate:
                vc.LoadAutosave();
                tbcMain.SelectedIndex = TBI_TEMPLATE;
                break;

            case IntroDialog.StartupType.LoadWorkspace:
                if (UnpackWorkspace())
                {
                    tbcMain.SelectedIndex = TBI_WORKSPACE;
                }
                break;

            default:
                break;
            }
        }
Пример #2
0
        private void ViewerControlCloseRequested(object sender, CloseRequestArgs e)
        {
            vc.Deactivate();
            vc.Dispose();

            vc      = new ViewerControl.ViewerControl();
            vc.Dock = DockStyle.Fill;

            vc.CloseRequested += ViewerControlCloseRequested;

            tbcMain.TabPages[TBI_TEMPLATE].Controls.Add(vc);
            vc.BringToFront();
            tbcMain.SelectedIndex = TBI_TEMPLATE;

            switch (e.ClosingState)
            {
            case CloseRequestArgs.ClosingReason.RevertToIntro:
                ShowIntroDialog();
                break;

            case CloseRequestArgs.ClosingReason.ExplicitNew:
                vc.CreateNewTemplate();
                break;

            case CloseRequestArgs.ClosingReason.ToLoadExisting:
                vc.ShowLoadTemplate();
                break;

            case CloseRequestArgs.ClosingReason.ApplicationExiting:
                tbcMain.SelectedIndex = TBI_WORKSPACE;
                if (resultsPanel.DoCloseWorkspace())
                {
                    Application.Exit();
                }
                break;

            default:
                break;
            }
        }