123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using DevExpress.XtraBars;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DevExpress.XtraBars.Docking2010.Views;
- using XzXdDw.App.UserControl;
- using DevExpress.XtraBars.Ribbon;
- using System.Threading;
- using DevExpress.XtraEditors;
- using ExtensionsDev;
- namespace XzXdDw
- {
- public partial class MainForm : XtraForm
- {
- Dictionary<string, Type> ctrlTypes = new Dictionary<string, Type>();
- public MainForm()
- {
- InitializeComponent();
- ctrlTypes.Add("星座协同定位", typeof(CtrlPosXz));
- ctrlTypes.Add("单星协同定位", typeof(CtrlPosSingle));
- ctrlTypes.Add("星历管理", typeof(CtrlXl));
- ctrlTypes.Add("系统设置", typeof(CtrlSysSettings));
- this.bar1.OptionsBar.DistanceBetweenItems = 20;
- this.tabbedView1.UseDefault();
- btnSet.Visibility = BarItemVisibility.Never;
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- DxHelper.WaitHelper.CloseForm();
- }
- 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;
- }
- }
- tabbedView1.ActivateDocument(doc.Control);
- }
- protected override void OnFormClosing(FormClosingEventArgs e)
- {
- if (e.CloseReason == CloseReason.UserClosing)
- {
- if (XtraMessageBox.Show("确定要退出当前系统吗?", "确认消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
- {
- e.Cancel = true;
- return;
- }
- }
- Application.Exit();
- }
- }
- }
|