1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using DataSimulation.Forms.UserControl;
- using DevExpress.XtraBars.Docking2010.Views;
- using DevExpress.XtraBars;
- using DevExpress.XtraBars.Docking2010.Views.Tabbed;
- using ExtensionsDev;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace DataSimulation.Forms
- {
- public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
- {
- Dictionary<string, Type> ctrlTypes = new Dictionary<string, Type>();
- public MainForm()
- {
- InitializeComponent();
- ribbon.UseDefault();
- tabbedView1.UseDefault();
- ctrlTypes.Add("任务管理", typeof(CtrlHome));
- ctrlTypes.Add("历史任务", typeof(CtrlHistoryTask));
- ctrlTypes.Add("星历管理", typeof(CtrlXl));
- ctrlTypes.Add("卫星管理", typeof(CtrlSat));
- ctrlTypes.Add("天线管理", typeof(CtrlAnt));
- ctrlTypes.Add("参考站管理", typeof(CtrlRef));
- ctrlTypes.Add("航迹管理", typeof(CtrlFlight));
- btn_ItemClick(null, null);
- }
- private void btn_ItemClick(object sender, ItemClickEventArgs e)
- {
- var btnTxt = e?.Item?.Caption ?? "任务管理";
- BaseDocument doc = null;
- doc = tabbedView1.Documents.Find(p => p.Control.GetType() == ctrlTypes[btnTxt]).FirstOrDefault();
- if (doc == null)
- {
- doc = tabbedView1.AddDocument((Control)Activator.CreateInstance(ctrlTypes[btnTxt]), btnTxt);
- if (doc.Control is Form form)
- {
- form.Text = "";
- doc.Caption = btnTxt;
- }
- if (btnTxt == "任务管理")
- doc.Properties.AllowClose = DevExpress.Utils.DefaultBoolean.False;
- else
- doc.Properties.AllowClose = DevExpress.Utils.DefaultBoolean.True;
- }
- tabbedView1.ActivateDocument(doc.Control);
- }
- }
- }
|