From 4fff01dd8941f97005cfffbcbfdd83e60b1c543d Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 04 十二月 2024 15:06:44 +0800
Subject: [PATCH] 下拉组织

---
 DevApp/Gs.DevApp/DevFrm/FrmMain.cs |   63 ++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs
index 7c67fdc..c00981d 100644
--- a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs
+++ b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs
@@ -18,6 +18,7 @@
 using Gs.DevApp.UserControl;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using static DevExpress.XtraReports.Design.XtraTabControl;
 
 namespace Gs.DevApp.DevFrm
 {
@@ -37,6 +38,44 @@
             FormClosing += FrmMain_FormClosing;
             barEasy.ItemClick += BarEasy_ItemClick;
             getTree();
+            tab.MouseDown += Tab_MouseDown;
+            tabCloseCurrent.Click += (s, e) =>
+            {
+                string name = tab.SelectedTabPage.Tooltip;
+                RemoveTabPage(tab, name);
+            };
+            tabCloseAll.Click += (s, e) =>
+            {
+                string _name = tab.SelectedTabPage.Tooltip;
+                int _tabCount = tab.TabPages.Count;
+                for (int i = _tabCount; i >= 0; i--)
+                {
+                    try
+                    {
+                        string name = tab.TabPages[i].Tooltip;
+                        if (name != _name)
+                        {
+                            RemoveTabPage(tab, name);
+                        }
+                    }
+                    catch (Exception)
+                    {
+                    }
+                }
+            };
+        }
+
+        private void Tab_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (e.Button == MouseButtons.Right)
+            {
+                tab.ContextMenuStrip = null;
+                //TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y));
+                //TreeListNode node = hInfo.Node;
+                //treeList1.FocusedNode = node;
+                tab.ContextMenuStrip = contextMenuStrip1;
+
+            }
         }
 
         private void BarEasy_ItemClick(object sender, ItemClickEventArgs e)
@@ -102,16 +141,12 @@
         /// <param name="e"></param>
         private void TooLoading_Click(object sender, EventArgs e)
         {
-            var i = 100;
-            var sdf = new ShowDialogForm("鎻愮ず", "", "璇疯�愬績绛夊�欙紝姝e湪鎿嶄綔涓紒");
-            for (var j = 0; j < i; j++)
-                sdf.SetCaption("鎵ц杩涘害锛�" + j + "/" + i + "锛�");
-            sdf.Close();
             getTree();
         }
 
-        private void getTree()
+        private async void getTree()
         {
+            UcLoading _loading = new UcLoading();
             toolTime.Text = "鐧诲綍鏃堕棿" + LoginInfoModel.CurrentUser.LoginTime;
             var _obj = new
             {
@@ -120,10 +155,11 @@
             };
             try
             {
-                var strJson = UtilityHelper.HttpPost("",
+                var strJson = await UtilityHelper.HttpPostAsync("",
                     "User/GetUserLoginInfo", JsonConvert.SerializeObject(_obj));
                 var _job = JObject.Parse(strJson);
                 var rtnCode = _job["rtnCode"].ToString();
+                _loading.Stop();
                 if (int.Parse(rtnCode) > 0)
                 {
                     acrd.Clear();
@@ -175,10 +211,8 @@
                                 AddTabpage(tab, tabPageName, tabText,
                                     newFormName, imgIcon);
                             }
-
                             idx++;
                         }
-
                         ;
                         gdx++;
                     }
@@ -190,8 +224,10 @@
             }
             catch (Exception ex)
             {
+                _loading.Stop();
                 MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
+
         }
 
         /// <summary>
@@ -217,7 +253,9 @@
         /// <param name="e"></param>
         private void Tab_CloseButtonClick(object sender, EventArgs e)
         {
-            RemoveTabPage(tab, e);
+            var args = (ClosePageButtonEventArgs)e;
+            var name = args.Page.Tooltip;
+            RemoveTabPage(tab, name);
         }
 
         /// <summary>
@@ -253,16 +291,13 @@
         /// <param name="tabControl"></param>
         /// <param name="tabPageName"></param>
         /// <param name="e"></param>
-        public void RemoveTabPage(XtraTabControl tabControl, EventArgs e)
+        public void RemoveTabPage(XtraTabControl tabControl, string name)
         {
             if (TabPageDic.Count <= 1)
             {
                 MsgHelper.Warning("璇疯嚦灏戜繚鐣欎竴涓姛鑳斤紒");
                 return;
             }
-
-            var args = (ClosePageButtonEventArgs)e;
-            var name = args.Page.Tooltip;
             foreach (XtraTabPage item in tabControl.TabPages)
                 if (item.Name == name)
                 {

--
Gitblit v1.9.3