From cc89c6b8112cfccd270951a9177c6ac0e5307d79 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 29 十月 2024 17:12:12 +0800
Subject: [PATCH] 优化颜色分级配置

---
 Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs |  350 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 322 insertions(+), 28 deletions(-)

diff --git a/Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs b/Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs
index 18a7f68..5eda6d2 100644
--- a/Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs
+++ b/Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs
@@ -2,6 +2,11 @@
 using DevExpress.XtraBars.Navigation;
 using DevExpress.XtraBars.Ribbon;
 using DevExpress.XtraEditors;
+using HStation.WinFrmUI;
+using HStation.WinFrmUI.Auth;
+using HStation.WinFrmUI.Basic;
+using HStation.WinFrmUI.Organize;
+using HStation.WinFrmUI.Xhs.PumpProduct;
 using System;
 using System.Drawing;
 using System.IO;
@@ -58,10 +63,12 @@
                 return cp;
             }
         }
+
         //icon
-        readonly NotifyIcon _app = null;
+        private readonly NotifyIcon _app = null;
 
         #region TileNavPane
+
         private void tileNavPane_ElementClick(object sender, NavElementEventArgs e)
         {
             var tagObj = e.Element.Tag;
@@ -80,31 +87,42 @@
             {
                 case "MapOverview":
                     {
-
                     }
                     break;
+
                 case "SystemConfig":
                     {
                         popSystemConfig.MinWidth = buttonInfo.Bounds.Width;
                         popSystemConfig.ShowPopup(point);
                     }
                     break;
+
+                case "SystemOrganize":
+                    {
+                        popSystemOrganize.MinWidth = buttonInfo.Bounds.Width;
+                        popSystemOrganize.ShowPopup(point);
+                    }
+                    break;
+
                 case "SystemAuthority":
                     {
                         popSystemAuthority.MinWidth = buttonInfo.Bounds.Width;
                         popSystemAuthority.ShowPopup(point);
                     }
                     break;
+
                 case "Minimize":
                     {
                         this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
                     }
                     break;
+
                 case "Close":
                     {
                         this.Close();
                     }
                     break;
+
                 default:
                     {
                         XtraMessageBox.Show($"鏈煡鍔熻兘:{tag}");
@@ -127,29 +145,133 @@
                     {
                         nb.Appearance.BackColor = Color.SteelBlue;
                         nb.Appearance.ForeColor = Color.White;
-
                     }
                     else
                     {
                         nb.Appearance.BackColor = Color.White;
                         nb.Appearance.ForeColor = Color.Black;
-
                     }
                 }
             }
         }
 
-
-        #endregion
-
-   
+        #endregion TileNavPane
 
         //鐢ㄦ按鍣ㄥ叿
         private void barBtnWaterUtensil_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
+        }
 
+        /// <summary>
+        /// 椤圭洰绠$悊
+        /// </summary>
+        private void barBtnProject_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "椤圭洰绠$悊",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                /*     var page = new XhsProjectMainPanel();
+                     page.PageTitle.Caption = guid.Function;
+                     page.PageGuid = guid;
+                     CreatePage(page, guid);*/
+            }
+        }
 
+        /// <summary>
+        /// 娉电鐞�
+        /// </summary>
+        private void barBtnPumpManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "娉电鐞�",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new PumpProductMainPanel();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
+        }
+
+        /// <summary>
+        /// 绫诲瀷绠$悊
+        /// </summary>
+        private void barButtonTypeManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "绫诲瀷绠$悊",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new SysTypeManageMainPanel();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
+        }
+
+        /// <summary>
+        /// 鍒嗙被绠$悊
+        /// </summary>
+        private void BtnCatlogManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "鍒嗙被绠$悊",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new SysCatalogManageMainPanel();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
+        }
+
+        /// <summary>
+        /// 灞炴�х鐞�
+        /// </summary>
+        private void BtnPropManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "灞炴�х鐞�",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new SysPropManageMainPanel();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
+        }
+
+        //瑙掕壊绠$悊
+        private void BarBtnRoleManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "瑙掕壊绠$悊",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                /* var page = new MenuMgrMainPanel();
+                 page.PageTitle.Caption = guid.Function;
+                 page.PageGuid = guid;
+                 CreatePage(page, guid);*/
+            }
         }
 
         /// <summary>
@@ -157,17 +279,15 @@
         /// </summary>
         private void barBtnPart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
-       /// <summary>
-       /// 绯荤粺绫诲瀷
-       /// </summary>
-       /// <param name="sender"></param>
-       /// <param name="e"></param>
+        /// <summary>
+        /// 绯荤粺绫诲瀷
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void barBtnSystemType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
         /// <summary>
@@ -175,7 +295,6 @@
         /// </summary>
         private void barBtnFacilities_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
         /// <summary>
@@ -185,7 +304,6 @@
         /// <param name="e"></param>
         private void barBtnBuilding_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
         /// <summary>
@@ -195,7 +313,6 @@
         /// <param name="e"></param>
         private void barBtnBuildingType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
         /// <summary>
@@ -205,27 +322,36 @@
         /// <param name="e"></param>
         private void barBtnSupplier_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
         }
 
         /// <summary>
-        /// 鐢ㄦ埛绠$悊
+        /// 鍛樺伐绠$悊
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void barBtnUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-
+            var guid = new PageGuid()
+            {
+                Function = "鍛樺伐绠$悊",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new EmployeeMgrMainPanel();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
         }
 
         /// <summary>
-        /// 鏉冮檺绠$悊 
+        /// 鏉冮檺绠$悊
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void barBtnAuthority_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-
         }
 
         /// <summary>
@@ -233,18 +359,186 @@
         /// </summary>
         private void barBtnSystemLog_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-
         }
 
- 
         /// <summary>
-        /// 
+        ///
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void barBtnWaterEquivalent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
- 
+        }
+
+        //鏄惁瀛樺湪Page
+        private bool IsExistPage(PageGuid sguid, bool isActivateDoc)
+        {
+            if (sguid == null)
+                return false;
+
+            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
+            {
+                foreach (BaseDocument doc in this.tabbedView1.Documents)
+                {
+                    if (doc.Tag != null)
+                    {
+                        if (doc.Tag is PageGuid)
+                        {
+                            if ((doc.Tag as PageGuid).ToString() == sguid.ToString())
+                            {
+                                if (isActivateDoc)
+                                    this.tabbedView1.Controller.Activate(doc);
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        //鏇存柊鏁版嵁
+        private void RefreshPageData(PageGuid sguid)
+        {
+            if (sguid == null)
+                return;
+
+            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
+            {
+                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
+                if (doc != null)
+                {
+                    if (doc.Control is DocumentPage page)
+                    {
+                        page.RefreshData();
+                    }
+                    return;
+                }
+            }
+        }
+
+        //鏇存柊PageTitle
+        private void UpdatePageTitle(PageGuid sguid, PageTitle title)
+        {
+            if (sguid == null || title == null)
+                return;
+
+            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
+            {
+                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
+                if (doc != null)
+                {
+                    doc.Caption = title.Caption;
+                    doc.ImageOptions.Image = title.HeaderImage;
+                    doc.ImageOptions.SvgImage = title.HeaderSvgImage;
+                    doc.ImageOptions.SvgImageSize = title.SvgImageSize;
+                    if (doc.Control is DocumentPage page)
+                    {
+                        page.PageTitle = title;
+                    }
+                    return;
+                }
+            }
+        }
+
+        //鍒涘缓Page
+        private bool CreatePage(DocumentPage page, PageGuid sguid)
+        {
+            if (page == null || sguid == null)
+                return false;
+            page.PageGuid = sguid;
+            page.Dock = DockStyle.Fill;
+            page.IsExistPageEvent += IsExistPage;
+            page.CreatePageEvent += CreatePage;
+            page.RefreshPageDataEvent += RefreshPageData;
+            page.UpdatePageTitleEvent += UpdatePageTitle;
+            page.ClosePageEvent += ClosePage;
+            page.ResetAllPagesEvent += ResetAllPages;
+            page.RegistEvents();
+
+            this.tabbedView1.BeginUpdate();
+            var doc = this.tabbedView1.AddDocument(page);
+            doc.Footer = Directory.GetCurrentDirectory();
+            doc.Properties.AllowClose = page.AllowClose() ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
+            if (page.PageTitle != null)
+            {
+                doc.Caption = page.PageTitle.Caption;
+                doc.ImageOptions.Image = page.PageTitle.HeaderImage;
+                doc.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage;
+                doc.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize;
+            }
+            else
+            {
+                doc.Caption = page.PageGuid?.Function;
+            }
+            doc.Tag = sguid;
+            this.tabbedView1.EndUpdate();
+            this.tabbedView1.Controller.Activate(doc);
+            this.tabbedView1.ActivateDocument(doc.Control);
+
+            page.InitialDataSource();
+            return true;
+        }
+
+        //鍏抽棴Page
+        private void ClosePage(PageGuid sguid)
+        {
+            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
+            {
+                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
+                if (doc != null)
+                {
+                    var page = doc.Control as DocumentPage;
+                    this.tabbedView1.Controller.Close(doc);//浼氳Е鍙戞鍦ㄥ叧闂拰鍏抽棴浜嬩欢
+                }
+            }
+        }
+
+        //鏌ユ壘page
+        private DocumentPage FindPage(PageGuid sguid, bool isActiveDoc)
+        {
+            if (sguid == null)
+                return default;
+            var sguid_msg = sguid.ToString();
+
+            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
+            {
+                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag.ToString() == sguid_msg);
+                if (doc != null)
+                {
+                    if (isActiveDoc)
+                        this.tabbedView1.Controller.Activate(doc);
+                    if (doc.Control is DocumentPage page)
+                    {
+                        return page;
+                    }
+                    return null;
+                }
+            }
+            return null;
+        }
+
+        //閲嶇疆鎵�鏈夐〉闈�
+        private void ResetAllPages()
+        {
+            this.tabbedView1.Controller.CloseAll();
+        }
+
+        private void GuideMain_Load(object sender, EventArgs e)
+        {
+            var guid = new PageGuid()
+            {
+                Function = "椤圭洰鎬昏",
+                Modular = ""
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new HomeXhsProjectPage_Bak();
+                page.PageTitle.Caption = guid.Function;
+                page.PageGuid = guid;
+                CreatePage(page, guid);
+            }
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3