Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();

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

            vc.CloseRequested += ViewerControlCloseRequested;

            resultsPanel      = new ResultsPanel();
            resultsPanel.Dock = DockStyle.Fill;

            resultsPanel.CloseRequested += ResultsPanelCloseRequested;
        }
Esempio n. 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;
            }
        }