lixiaojun
2024-09-27 ce1cc10e518ddac71cfefd433f8a6af9fb46ed40
Desktop/HStation.Desktop.Xhs.Core/MainForm.cs
@@ -1,14 +1,16 @@
using DevExpress.CodeParser;
using DevExpress.XtraBars.Docking;
using DevExpress.XtraBars.Docking2010.Views;
using DevExpress.XtraBars.Navigation;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraEditors;
using HStation.WinFrmUI;
using HStation.WinFrmUI.Assets;
using HStation.WinFrmUI.Auth.Core._02_User;
using HStation.WinFrmUI.Basic;
using HStation.WinFrmUI.Xhs.PumpProduct;
using System.IO;
using Yw.WinFrmUI;
using Yw.WinFrmUI.Page;
using static DevExpress.XtraPrinting.BarCode.DataBarExpandedPatternProcessor;
namespace HStation.Desktop
{
@@ -64,7 +66,9 @@
            {
                var hitInfo = this.tileNavPane.CalcHitInfo(e.Location);
                if (hitInfo.InButton)
                {
                    return;
                }
                this.DragMove();
            }
        }
@@ -75,48 +79,391 @@
            var item = e.Element as NavButton;
            if (item.Tag != null)
            {
                if (item.Tag is int)
                if (item.Tag is string)
                {
                    // var modular = (eModular)(int)item.Tag;
                    // SelectModular(modular, null);
                }
            }
        }
        //首页
        private void nbTitle_ElementClick(object sender, NavElementEventArgs e)
        {
            var guid = new PageGuid()
            {
                Modular = "Xhs",
                MoudingType = eMoudingType.Tab,
                Function = "Home"
            };
            if (!IsExistPage(guid, true))
            {
                var page = new HomeXhsProjectPage_Bak();
                CreatePage(page, guid);
            }
        }
        #endregion
        //项目管理
        private void nbProjectMgr_ElementClick(object sender, NavElementEventArgs e)
        {
            var guid = new PageGuid()
            {
                Modular = "Xhs",
                MoudingType = eMoudingType.Tab,
                Function = "ProjectMgr",
            };
            if (!IsExistPage(guid, true))
            {
                var page = new XhsProjectMgrPage();
                CreatePage(page, guid);
            }
        }
        //模型管理
        private void nbModelMgr_ElementClick(object sender, NavElementEventArgs e)
        {
            var pt = this.tileNavPane.PointToClient(MousePosition);
            var hitInfo = this.tileNavPane.CalcHitInfo(pt);
            if (hitInfo.ButtonInfo != null)
            {
                if (_bimfaceMgrBeakCtrl == null)
                {
                    var peakItemList = new List<Yw.WinFrmUI.TilePeekItem>()
                    {
                        new TilePeekItem()
                        {
                            Caption="水力场景",
                            SvgImage=svgImg32Model[0],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Hydro",
                                    MoudingType=eMoudingType.Tab,
                                    Function="SceneMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new Yw.WinFrmUI.HydroSceneMgrPage();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                        new TilePeekItem(){
                            Caption="水力模型",
                            SvgImage=svgImg32Model[1],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Hydro",
                                    MoudingType=eMoudingType.Tab,
                                    Function="ModelMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new HStation.WinFrmUI.HydroModelMgrPage();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                        new TilePeekItem(){
                            Caption="三维模型",
                            SvgImage=svgImg32Model[2],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Bimface",
                                    MoudingType=eMoudingType.Tab,
                                    Function="FileMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new Yw.WinFrmUI.BimfaceFileMgrPage();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                    };
                    _bimfaceMgrBeakCtrl = peakItemList.CreatePeekCtrl();
                }
                this.flyoutPanel1.Size = _bimfaceMgrBeakCtrl.Size;
                this.flyoutPanelControl1.Controls.Clear();
                this.flyoutPanelControl1.Controls.Add(_bimfaceMgrBeakCtrl);
                var rectangle = this.RectangleToScreen(hitInfo.ButtonInfo.Bounds);
                this.flyoutPanel1.ShowBeakForm(rectangle);
            }
        }
        private Control _bimfaceMgrBeakCtrl = null;//bimface管理弹出界面
        private Control _SystemProductManageCtrl = null;//产品管理弹出界面
        private Control _SystemSystemConfigCtrl = null;//系统配置弹出界面
        //产品管理
        private void nbProductManage_ElementClick(object sender, NavElementEventArgs e)
        {
            var pt = this.tileNavPane.PointToClient(MousePosition);
            var hitInfo = this.tileNavPane.CalcHitInfo(pt);
            if (hitInfo.ButtonInfo != null)
            {
                if (_SystemProductManageCtrl == null)
                {
                    var peakItemList = new List<Yw.WinFrmUI.TilePeekItem>()
                    {
                        new TilePeekItem(){
                            Caption="水泵管理",
                            SvgImage=svgImg32Model[3],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Asstes",
                                    MoudingType=eMoudingType.Tab,
                                    Function="pumpMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new PumpProductMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                        new TilePeekItem(){
                            Caption="阀门管理",
                            SvgImage=svgImg32Model[7],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Asstes",
                                    MoudingType=eMoudingType.Tab,
                                    Function="ValveMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new ValveManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                          new TilePeekItem(){
                            Caption="管道附件",
                            SvgImage=svgImg32Model[8],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Asstes",
                                    MoudingType=eMoudingType.Tab,
                                    Function="AdaptingMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new AdaptingManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                                new TilePeekItem(){
                            Caption="管道管理",
                            SvgImage=svgImg32Model[9],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Asstes",
                                    MoudingType=eMoudingType.Tab,
                                    Function="PipeLineMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new PipeLineManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        }
                    };
                    _SystemProductManageCtrl = peakItemList.CreatePeekCtrl();
                }
                this.flyoutPanel1.Size = _SystemProductManageCtrl.Size;
                this.flyoutPanelControl1.Controls.Clear();
                this.flyoutPanelControl1.Controls.Add(_SystemProductManageCtrl);
                var rectangle = this.RectangleToScreen(hitInfo.ButtonInfo.Bounds);
                this.flyoutPanel1.ShowBeakForm(rectangle);
            }
        }
        //系统配置
        private void nbSystemConfig_ElementClick(object sender, NavElementEventArgs e)
        {
            var pt = this.tileNavPane.PointToClient(MousePosition);
            var hitInfo = this.tileNavPane.CalcHitInfo(pt);
            if (hitInfo.ButtonInfo != null)
            {
                if (_SystemSystemConfigCtrl == null)
                {
                    var peakItemList = new List<Yw.WinFrmUI.TilePeekItem>()
                    {
                        new TilePeekItem(){
                            Caption="角色管理",
                            SvgImage=svgImg32Model[3],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Auth",
                                    MoudingType=eMoudingType.Tab,
                                    Function="UserManageMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new UserMgrMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                        new TilePeekItem(){
                            Caption="用户管理",
                            SvgImage=svgImg32Model[7],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Auth",
                                    MoudingType=eMoudingType.Tab,
                                    Function="ValveMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new ValveManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                        new TilePeekItem(){
                            Caption="菜单管理",
                            SvgImage=svgImg32Model[2],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Auth",
                                    MoudingType=eMoudingType.Tab,
                                    Function="TypeMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new SysTypeManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                             new TilePeekItem(){
                            Caption="类型管理",
                            SvgImage=svgImg32Model[4],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Basic",
                                    MoudingType=eMoudingType.Tab,
                                    Function="TypeMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new SysTypeManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                          new TilePeekItem(){
                            Caption="分类管理",
                            SvgImage=svgImg32Model[5],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Basic",
                                    MoudingType=eMoudingType.Tab,
                                    Function="CataLogMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new SysCatalogManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                         },      new TilePeekItem(){
                            Caption="属性管理",
                            SvgImage=svgImg32Model[6],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Basic",
                                    MoudingType=eMoudingType.Tab,
                                    Function="PropMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new SysPropManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                         },
                        new TilePeekItem(){
                            Caption="字典类型",
                            SvgImage=svgImg32Model[1],
                            SvgImageSize=new Size(24,24),
                            Click=()=>{
                                this.flyoutPanel1.HideBeakForm();
                                var guid=new PageGuid(){
                                    Modular="Dict",
                                    MoudingType=eMoudingType.Tab,
                                    Function="DictMgr",
                                };
                                if(!IsExistPage(guid,true))
                                {
                                    var page=new HStation.WinFrmUI.Dict.DictManageMainPanel();
                                    CreatePage(page,guid);
                                }
                            }
                        },
                     };
                    _SystemSystemConfigCtrl = peakItemList.CreatePeekCtrl();
                }
                this.flyoutPanel1.Size = _SystemSystemConfigCtrl.Size;
                this.flyoutPanelControl1.Controls.Clear();
                this.flyoutPanelControl1.Controls.Add(_SystemSystemConfigCtrl);
                var rectangle = this.RectangleToScreen(hitInfo.ButtonInfo.Bounds);
                this.flyoutPanel1.ShowBeakForm(rectangle);
            }
        }
        #endregion TileNavPane 相关处理
        #region 窗体事件
        //界面记载事件
        private void MainForm_Load(object sender, EventArgs e)
        {
        }
        //界面显示事件
        private async void MainForm_Shown(object sender, EventArgs e)
        private void MainForm_Shown(object sender, EventArgs e)
        {
            var homeGuid = new PageGuid()
            var guid = new PageGuid()
            {
                Modular = "Xhs",
                MoudingType = eMoudingType.Tab,
                Function = "home"
                Function = "Home"
            };
            var homePage = new HomeXhsProjectPage();
            this.CreatePage(homePage, homeGuid);
            var bimfaceGuid = new PageGuid()
            if (!IsExistPage(guid, true))
            {
                Modular = "Bimface",
                MoudingType = eMoudingType.Tab,
                Function = "view",
                TagName = "1815932337632972800"
            };
            var project = await new HStation.BLL.XhsProjectStd().GetByID(1815932337632972800);
            var page = new ViewXhsProjectBimfacePage();
            page.SetBindingData(project);
            this.CreatePage(page, bimfaceGuid);
                var page = new HomeXhsProjectPage();
                //var page = new HomeXhsProjectPage();
                CreatePage(page, guid);
            }
        }
        //界面正在退出时确认
@@ -135,7 +482,6 @@
        //界面退出
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
        }
        //窗体尺寸改变
@@ -143,15 +489,13 @@
        {
            if (this.WindowState == FormWindowState.Maximized)
            {
            }
            else
            {
            }
        }
        #endregion
        #endregion 窗体事件
        #region TabbedView 相关事件处理程序
@@ -166,10 +510,14 @@
            SelectModular(surfaceGuid.Modular, surfaceGuid);
        }
        //添加
        //添加
        private void tabbedView1_DocumentAdded(object sender, DocumentEventArgs e)
        {
            if (this.tabbedView1.Documents.Count > 1)
            {
                this.navBtnPrevious.Visible = true;
                this.navBtnNext.Visible = true;
            }
        }
        //激活
@@ -178,15 +526,16 @@
            var page = e.Document.Control as DocumentPage;
            if (page == null)
                return;
            this.navBtnCurrent.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage;
            this.navBtnCurrent.Caption = page.PageTitle.Caption;
        }
        //关闭 此时控件已经为空
        private void tabbedView1_DocumentClosed(object sender, DocumentEventArgs e)
        {
        }
        #endregion
        #endregion TabbedView 相关事件处理程序
        #region Page
@@ -364,6 +713,7 @@
                            docPnl.ImageOptions.Image = page.PageTitle.HeaderImage;
                            docPnl.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage;
                            docPnl.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize;
                            docPnl.Options.ShowCloseButton = page.PageTitle.AllowClose;
                        }
                        docPnl.ControlContainer.Controls.Add(page);
                        docPnl.Tag = pguid;
@@ -371,6 +721,7 @@
                        docPnl.Show();
                    }
                    break;
                case eMoudingType.Tab:
                    {
                        this.tabbedView1.BeginUpdate();
@@ -382,12 +733,14 @@
                            doc.ImageOptions.Image = page.PageTitle.HeaderImage;
                            doc.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage;
                            doc.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize;
                            doc.Properties.AllowClose = page.PageTitle.AllowClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                        }
                        doc.Tag = pguid;
                        this.tabbedView1.EndUpdate();
                        this.tabbedView1.Controller.Activate(doc);
                    }
                    break;
                default: break;
            }
            page.InitialDataSource();
@@ -413,6 +766,7 @@
                        }
                    }
                    break;
                case eMoudingType.Tab:
                    {
                        if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
@@ -425,11 +779,12 @@
                        }
                    }
                    break;
                default: break;
            }
        }
        #endregion
        #endregion Page
        #region Modular
@@ -453,7 +808,7 @@
            //    }
            //}
            //this.docPnlFuncList.Text = modular.ToString();
            //this.funcTreeListCtrl1.SetBindingData(modular, surfaceGuid);
            //this.funcTreeListCtrl1.SetMatching(modular, surfaceGuid);
            //if (surfaceGuid == null)
            //{
            //    var func = this.funcTreeListCtrl1.SetDefault();
@@ -462,10 +817,16 @@
            //}
        }
        #endregion Modular
        #endregion
        private void navBtnPrevious_ElementClick(object sender, NavElementEventArgs e)
        {
            this.tabbedView1.Controller.SelectNextTab(false);
        }
        private void navBtnNext_ElementClick(object sender, NavElementEventArgs e)
        {
            this.tabbedView1.Controller.SelectNextTab(true);
        }
    }
}
}