private void Form1_Load(object sender, EventArgs e) { tbcMain.TabPages[TBI_TEMPLATE].Controls.Add(vc); vc.BringToFront(); tbcMain.TabPages[TBI_WORKSPACE].Controls.Add(resultsPanel); resultsPanel.BringToFront(); tbcMain.SelectedIndexChanged += TbcMain_SelectedIndexChanged; }
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; } }