From 6bca8fcd37a48808a0b9c9342fc1be0adddfece6 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 08 五月 2020 17:46:44 +0800
Subject: [PATCH] 请合并最新代码,优化绑定信息

---
 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs |  273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 273 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs
new file mode 100755
index 0000000..1b5698f
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs
@@ -0,0 +1,273 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.HideOption
+{
+    /// <summary>
+    /// 闅愬尶鍔熻兘鐨勪富鐣岄潰
+    /// </summary>
+    public class HideOptionMainForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalListRefreshControl listView = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        public void ShowForm()
+        {
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText("闅愬尶涓荤晫闈�");
+
+            listView = new VerticalListRefreshControl(23);
+            listView.BackgroundColor = UserCenterColor.Current.White;
+            listView.Height = bodyFrameLayout.Height;
+            bodyFrameLayout.AddChidren(listView);
+            listView.BeginHeaderRefreshingAction += () =>
+            {
+                //鍒濆鍖栦腑閮ㄤ俊鎭�
+                this.InitMiddleFrame();
+                listView.EndHeaderRefreshing();
+            };
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            listView.RemoveAll();
+
+            this.AddNormalRowControl("褰撳墠韬唤", 400, UserCenterResourse.UserInfo.AuthorityText, 400);
+
+            this.AddTopButtomRowControl("浣忓畢ID", 400, Common.Config.Instance.Home.Id, 900);
+
+            this.AddTopButtomRowControl("璐﹀彿GUID", 400, string.IsNullOrEmpty(Common.Config.Instance.Guid) == true ? Common.Config.Instance.Home.MainUserDistributedMark : Common.Config.Instance.Guid, 900);
+
+            this.AddNormalRowControl("浣忓畢鍒嗕韩", 400, Common.Config.Instance.Home.IsOthreShare == true ? "鏄�" : "鍚�", 400);
+
+            this.AddNormalRowControl("璐﹀彿绫诲瀷", 400, Common.Config.Instance.Home.AccountType.ToString(), 400);
+
+            this.AddNormalRowControl("杩滅▼杩炴帴", 400, ZigBee.Device.ZbGateway.IsRemote == true ? "鏄�" : "鍚�", 400);
+
+            this.AddNormalRowControl("鎷ユ湁杩滅▼鏉冮檺", 400, ZigBee.Device.ZbGateway.AllowRemoteCtrl == true ? "鏄�" : "鍚�", 400);
+
+            this.AddNormalRowControl("WIFI鍙橀噺", 400, Shared.Application.IsWifi == true ? "true" : "false", 400);
+
+            int count = HdlGatewayLogic.Current.GetAllLocalGateway().Count;
+            var row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.UseClickStatu = false;
+            row1.AddLeftCaption("鏈湴缃戝叧", 400);
+            if (count > 0)
+            {
+                row1.UseClickStatu = true;
+                row1.AddRightArrow();
+                row1.ButtonClickEvent += (sender, e) =>
+                {
+                    var form = new HideOptionGatewayListForm();
+                    form.AddForm(1);
+                };
+            }
+            row1.AddMostRightView(count + "涓�", 400);
+            row1.AddBottomLine();
+
+            count = ZigBee.Device.ZbGateway.GateWayList.Count;
+            row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.UseClickStatu = false;
+            row1.AddLeftCaption("缂撳瓨涓殑缃戝叧", 400);
+            if (count > 0)
+            {
+                row1.UseClickStatu = true;
+                row1.AddRightArrow();
+                row1.ButtonClickEvent += (sender, e) =>
+                {
+                    var form = new HideOptionGatewayListForm();
+                    form.AddForm(2);
+                };
+            }
+            row1.AddMostRightView(count + "涓�", 400);
+            row1.AddBottomLine();
+
+            //妫�娴嬭兘鍚﹀箍鎾緱鍒扮綉鍏�
+            this.AddCheckReceviceGatewayRow();
+
+            row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.AddLeftCaption("娓呴櫎缂撳瓨鏂囦欢", 500);
+            row1.AddRightArrow();
+            row1.AddBottomLine();
+            row1.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new HideOptionDirectoryListForm();
+                form.AddForm();
+            };
+
+#if Android
+            row1 = new FrameRowControl(listView.rowSpace / 2);
+            row1.UseClickStatu = false;
+            listView.AddChidren(row1);
+            row1.AddLeftCaption("GBS瀹氫綅", 500);
+            row1.AddBottomLine();
+            var btnGbsSwitch = row1.AddMostRightSwitchIcon();
+            string checkFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Shared.Phone.UserCenter.DirNameResourse.OpenGbsFile);
+            if (System.IO.File.Exists(checkFile) == true)
+            {
+                btnGbsSwitch.IsSelected = true;
+            }
+            btnGbsSwitch.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowMassage(ShowMsgType.Confirm, "娉ㄦ剰:寮�鍚垨鑰呭叧闂鍔熻兘浼氶噸鍚疉pp", () =>
+                {
+                    btnGbsSwitch.IsSelected = !btnGbsSwitch.IsSelected;
+                    if (btnGbsSwitch.IsSelected == true)
+                    {
+                        var file = System.IO.File.Create(checkFile);
+                        file.Close();
+                    }
+                    else
+                    {
+                        System.IO.File.Delete(checkFile);
+                    }
+                    HDLUtils.RestartApp();
+                });
+            };
+#endif
+            row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.AddLeftCaption("涓婁紶Log", 500);
+            row1.AddRightArrow();
+            row1.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowMassage(ShowMsgType.Confirm, "鏄惁涓婁紶Log鏂囦欢", () =>
+                {
+                    HdlThreadLogic.Current.RunThread(async () =>
+                    {
+                        await HdlBackupLogic.Current.UpLoadLogBackup();
+                    });
+                });
+            };
+
+            listView.AdjustRealHeight(Application.GetRealHeight(23));
+        }
+
+        /// <summary>
+        /// 娣诲姞琛�
+        /// </summary>
+        /// <param name="caption"></param>
+        /// <param name="width1"></param>
+        /// <param name="viewText"></param>
+        /// <param name="width2"></param>
+        private FrameRowControl AddNormalRowControl(string caption, int width1, string viewText, int width2)
+        {
+            var row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.AddLeftCaption(caption, width1);
+            row1.AddMostRightView(viewText, width2);
+            row1.AddBottomLine();
+            row1.UseClickStatu = false;
+
+            return row1;
+        }
+
+        /// <summary>
+        /// 娣诲姞琛�
+        /// </summary>
+        /// <param name="caption"></param>
+        /// <param name="width1"></param>
+        /// <param name="viewText"></param>
+        /// <param name="width2"></param>
+        private FrameRowControl AddTopButtomRowControl(string caption, int width1, string viewText, int width2)
+        {
+            var row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.AddTopView(caption, width1);
+            row1.AddBottomView(viewText, width2);
+            row1.AddBottomLine();
+            row1.UseClickStatu = false;
+
+            return row1;
+        }
+
+        /// <summary>
+        /// 妫�娴嬭兘鍚﹀箍鎾緱鍒扮綉鍏�
+        /// </summary>
+        private void AddCheckReceviceGatewayRow()
+        {
+            var row1 = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            row1.AddLeftCaption("妫�娴嬭兘鍚﹀箍鎾緱鍒扮綉鍏�", 700);
+            row1.AddRightArrow();
+            row1.AddBottomLine();
+            var btnCount = row1.AddMostRightView("", 400);
+            row1.ButtonClickEvent += (sender, e) =>
+            {
+                int waiteCount = 5;
+                this.ShowMassage(ShowMsgType.Confirm, "璇ユ搷浣滃皢绛夊緟" + waiteCount + "绉�,鏄惁缁х画锛�", () =>
+                {
+                    Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest = new Dictionary<string, ZbGateway>();
+                    UserCenterResourse.HideOption.CheckCanReceiveGateway = 1;
+                    HdlThreadLogic.Current.RunThread(() =>
+                    {
+                        while (waiteCount > 0)
+                        {
+                            HdlThreadLogic.Current.RunMain(() =>
+                            {
+                                btnCount.Text = "璇风瓑寰�" + waiteCount + "绉�";
+                            });
+                            System.Threading.Thread.Sleep(1000);
+                            waiteCount--;
+                        }
+                        HdlThreadLogic.Current.RunMain(() =>
+                        {
+                            btnCount.Text = string.Empty;
+                        });
+                        //缁撴潫
+                        UserCenterResourse.HideOption.CheckCanReceiveGateway = 0;
+                        if (Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest.Count == 0)
+                        {
+                            this.ShowMassage(ShowMsgType.Normal, "鎶辨瓑,娌℃湁骞挎挱鍒颁换浣曠綉鍏�");
+                            return;
+                        }
+                        HdlThreadLogic.Current.RunMain(() =>
+                        {
+                            var form = new HideOptionGatewayListForm();
+                            form.AddForm(3);
+                        });
+                    });
+                });
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+        /// <summary>
+        /// 鐣岄潰鍏抽棴
+        /// </summary>
+        public override void CloseFormBefore()
+        {
+            Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest = null;
+            UserCenterResourse.HideOption.CheckCanReceiveGateway = 0;
+
+            base.CloseFormBefore();
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0