Пример #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;
        }
Пример #2
0
        private void ResultsPanelCloseRequested(object sender, CloseRequestArgs e)
        {
            resultsPanel.Deactivate();
            resultsPanel.Dispose();

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

            resultsPanel.CloseRequested += ResultsPanelCloseRequested;

            tbcMain.TabPages[TBI_WORKSPACE].Controls.Add(resultsPanel);
            resultsPanel.BringToFront();
            tbcMain.SelectedIndex = TBI_WORKSPACE;

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

            case CloseRequestArgs.ClosingReason.ToLoadExisting:
                resultsPanel.OpenWorkspace();
                break;

            case CloseRequestArgs.ClosingReason.ApplicationExiting:
                tbcMain.SelectedIndex = TBI_TEMPLATE;
                if (vc.DoCloseTemplate())
                {
                    Application.Exit();
                }
                break;

            default:
                break;
            }
        }