From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserView/UserPage.cs |  881 ++++++++++++++++++++++++----------------------------------
 1 files changed, 371 insertions(+), 510 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
index 8ffd033..09ae903 100755
--- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
@@ -1,298 +1,26 @@
 锘縰sing System;
 using System.Collections.Generic;
 using Shared.Common;
-using ZigBee.Device;
-using Shared.Phone.Device.AC;
-
+using System.Text;
+using Shared.Phone.UserCenter;
+
 namespace Shared.Phone.UserView
 {
     /// <summary>
     /// User page.
     /// </summary>
-    public class UserPage : FrameLayout,ZigBee.Common.IStatus
-    {
-        #region 鈼� 鍙橀噺_______________________
-        /// <summary>
-        /// The user menu page.
-        /// </summary>
-        static UserPage userMenuPage;
-        /// <summary>
-        /// 搴曢儴鍗曠嫭鑿滃崟鐨勫搴�-360
-        /// </summary>
-        private static readonly int tabBarEnum_Width = CommonPage.AppRealWidth / 3;
-        /// <summary>
-        /// 搴曢儴鎸夐挳鍥剧墖鐨勯珮搴�
-        /// </summary>
-        private static readonly int tabBarEnumIMG_Height = 98;
-        /// <summary>
-        /// 搴曢儴鎸夐挳鍥剧墖鐨勫搴�
-        /// </summary>
-        private static readonly int tabBarEnumIMG_Width = 138;
-        /// <summary>
-        /// 搴曢儴鎸夐挳鍥剧墖鐨刌鍊�
-        /// </summary>
-        private static readonly int tabBarEnumIMG_Y = 3;
-        /// <summary>
-        /// 搴曢儴鎸夐挳鏂囧瓧鐨勯珮搴�
-        /// </summary>
-        private static readonly int tabBarEnumName_Height = 40;
-        /// <summary>
-        /// 搴曢儴鎸夐挳鏂囧瓧鐨刌鍊�
-        /// </summary>
-        private static readonly int tabBarEnumName_Y = 104;
-        #endregion
+    public class UserPage : FrameLayout
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
 
-        #region 鈼� 鎺ュ彛____________________________
-
-        /// <summary>
-        /// 璇ユ帴鍙e皢寮冪敤 !!!!!!
-        /// 鏀圭敤DeviceInfoChange()
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勮彍鍗�
         /// </summary>
-        /// <returns>The changed.</returns>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-
-        }
-
+        private MenuSelectEnum nowSelectMenu = MenuSelectEnum.A鏈�夋嫨;
         /// <summary>
-        /// 璁惧鐘舵�佹洿鏂版帴鍙�
-        /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
-        /// <para>type锛氬鏋滀负 IASInfoReport:RemoveDeviceRespon</para>
-        /// <para>type锛氬鏋滀负 DeviceStatusReport:璁惧涓婃姤</para>
-        /// <para>type锛氬鏋滀负 IASInfoReport:IAS瀹夐槻淇℃伅涓婃姤</para>
-        /// <para>type锛氬鏋滀负 OnlineStatusChange: 璁惧鍦ㄧ嚎鐘舵�佹洿鏂�</para>
+        /// 鐢ㄦ埛鐣岄潰
         /// </summary>
-        /// <param name="common">Common.</param>
-        /// <param name="typeTag">Type tag.</param>
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-            var myDevice = LocalDevice.Current.GetDevice(common.DeviceAddr, common.DeviceEpoint);
-            if (myDevice == null)
-            {
-                return;
-            }
-            //璁惧涓婃姤鐘舵�佷腑 褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-            if (typeTag == "DeviceStatusReport")
-            {
-                try
-                {
-                    switch (myDevice.Type)
-                    {
-                        case DeviceType.OnOffOutput:
-                            //寮�鍏冲姛鑳�
-                            if (common.DeviceStatusReport.CluterID == 6)
-                            {
-                                var onOffOutputLight = (ToggleLight)myDevice;
-                                onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport;
-                                //璁板綍銆佹洿鏂扮姸鎬�
-                                if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
-                                {
-                                    return;
-                                }
-                                onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                onOffOutputLight.LastDateTime = DateTime.Now;
-                            }
-                            //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                            if (common.DeviceStatusReport.CluterID == 3)
-                            {
-                                myDevice.IsOnline = 1;
-                                myDevice.LastDateTime = DateTime.Now;
-                            }
-                            break;
-
-                        case DeviceType.AirSwitch:
-                            //寮�鍏冲姛鑳�
-                            if (common.DeviceStatusReport.CluterID == 6)
-                            {
-                                var airSwitch = (AirSwitch)myDevice;
-                                airSwitch.DeviceStatusReport = common.DeviceStatusReport;
-                                if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
-                                {
-                                    return;
-                                }
-                                airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                airSwitch.LastDateTime = DateTime.Now;
-
-                            }
-                            //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                            if (common.DeviceStatusReport.CluterID == 3)
-                            {
-                                myDevice.IsOnline = 1;
-                                myDevice.LastDateTime = DateTime.Now;
-                            }
-                            break;
-
-                        case DeviceType.WindowCoveringDevice:
-                            if (common.DeviceStatusReport.CluterID == 258)
-                            {
-                                var rollershade = (Rollershade)myDevice;
-                                rollershade.DeviceStatusReport = common.DeviceStatusReport;
-                                var attriButeList = rollershade.DeviceStatusReport.AttriBute;
-                                if (attriButeList == null || attriButeList.Count == 0)
-                                {
-                                    return;
-                                }
-                                switch (attriButeList[0].AttributeId)
-                                {
-                                    case 0:
-                                        rollershade.WcdType = attriButeList[0].AttriButeData;
-                                        rollershade.LastDateTime = DateTime.Now;
-                                        break;
-                                }
-                            }
-                            if (common.DeviceStatusReport.CluterID == 3)
-                            {
-                                myDevice.IsOnline = 1;
-                                myDevice.LastDateTime = DateTime.Now;
-                            }
-                            break;
-
-                        case DeviceType.Thermostat:
-                            //AC鍔熻兘
-                            if (common.DeviceStatusReport.CluterID == 513)
-                            {
-                                var ac = (AC)myDevice;
-                                ac.DeviceStatusReport = common.DeviceStatusReport;
-                                var attriButeList = ac.DeviceStatusReport.AttriBute;
-                                if (attriButeList == null || attriButeList.Count == 0)
-                                {
-                                    return;
-                                }
-                                //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
-                                var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
-                                switch (attriButeList[0].AttributeId)
-                                {
-                                    case 0:
-                                        ac.currentLocalTemperature = curTemp;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-
-                                    case 17:
-                                        ac.currentCoolingSetpoint = curTemp;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-
-                                    case 18:
-                                        ac.currentHeatingSetpoint = curTemp;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-
-                                    case 4096:
-                                        ac.currentAutoSetpoint = curTemp;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-
-                                    case 28:
-                                        ac.currentSystemMode = attriButeList[0].AttriButeData;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-                                }
-                            }
-
-                            if (common.DeviceStatusReport.CluterID == 514)
-                            {
-                                var ac = (AC)myDevice;
-                                var attriButeList = common.DeviceStatusReport.AttriBute;
-                                if (attriButeList == null || attriButeList.Count == 0)
-                                {
-                                    return;
-                                }
-                                ac.DeviceStatusReport = common.DeviceStatusReport;
-                                switch (attriButeList[0].AttributeId)
-                                {
-                                    case 0:
-                                        ac.currentFanMode = attriButeList[0].AttriButeData;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-                                    case 4096:
-                                        ac.currentFanSwingMode = attriButeList[0].AttriButeData;
-                                        ac.LastDateTime = DateTime.Now;
-                                        break;
-                                }
-                            }
-
-                            //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                            if (common.DeviceStatusReport.CluterID == 3)
-                            {
-                                myDevice.IsOnline = 1;
-                                myDevice.LastDateTime = DateTime.Now;
-                            }
-                            break;
-
-                        case DeviceType.DimmableLight:
-                            //璋冨厜鐏姛鑳�
-                            //寮�鍏冲姛鑳�
-                            if (common.DeviceStatusReport.CluterID == 6)
-                            {
-                                var dimmableLight = (DimmableLight)myDevice;
-                                dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
-                                //璁板綍銆佹洿鏂扮姸鎬�
-                                if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
-                                {
-                                    return;
-                                }
-                                dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                dimmableLight.LastDateTime = DateTime.Now;
-                            }
-                            //浜害
-                            if (common.DeviceStatusReport.CluterID == 8)
-                            {
-                                var dimmableLight = (DimmableLight)myDevice;
-                                dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
-                                var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
-                                if (attriButeList == null || attriButeList.Count == 0)
-                                {
-                                    return;
-                                }
-                                switch (attriButeList[0].AttributeId)
-                                {
-                                    case 0:
-                                        dimmableLight.Level = attriButeList[0].AttriButeData;
-                                        dimmableLight.LastDateTime = DateTime.Now;
-                                        break;
-                                }
-                            }
-                            //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                            if (common.DeviceStatusReport.CluterID == 3)
-                            {
-                                myDevice.IsOnline = 1;
-                                myDevice.LastDateTime = DateTime.Now;
-                            }
-                            break;
-                    }
-                }
-                catch (Exception ex)
-                {
-                    System.Console.WriteLine($"Error:{ex.Message}");
-                }
-            }
-            //璁惧鍦ㄧ嚎鐘舵�佷笂鎶�
-            else if (typeTag == "OnlineStatusChange")
-            {
-                myDevice.IsOnline = common.IsOnline;
-                //璁板綍鍥炲鏃堕棿
-                myDevice.LastDateTime = DateTime.Now;
-            }
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-            //throw new NotImplementedException();
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
-            //throw new NotImplementedException();
-        }
-        #endregion
-
+        private static UserPage userMenuPage = null;
         /// <summary>
         /// 鐢ㄦ埛鐣岄潰
         /// </summary>
@@ -307,245 +35,378 @@
                 }
                 return userMenuPage;
             }
-        }
-
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
+        /// </summary>
+        private NormalFrameLayout bodyFrameView = null;
+        /// <summary>
+        /// 鐣岄潰缂撳瓨(2020.05.07:鍒囨崲鏃朵笉绉婚櫎鐣岄潰,鐩存帴闅愯棌)
+        /// </summary>
+        private List<EditorCommonForm> listForm = new List<EditorCommonForm>() { null, null, null };
+        /// <summary>
+        /// 鎺т欢缂撳瓨(鐪嬩笉鎳傜殑璇�,涓嶈鍔ㄥ畠)
+        /// </summary>
+        private List<ButtonBase> listButton = new List<ButtonBase>();
+        /// <summary>
+        /// 濡傛灉璁剧疆姝ゅ彉閲忎负true,鍒欏湪鍗曞嚮搴曢儴鑿滃崟鏃�,寮哄埗鏃犳潯浠跺叏閮ㄥ埛鏂�
+        /// </summary>
+        public bool RefreshAllForm = false;
+        /// <summary>
+        /// 鍒锋柊涓婚〉
+        /// </summary>
+        public bool RefreshMainPageForm = false;
+        /// <summary>
+        /// 鍒锋柊鍒嗙被
+        /// </summary>
+        public bool RefreshCategoryForm = false;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
         /// <summary>
-        /// Initializes a new instance of the <see cref="T:Shared.Phone.UserView.UserPage"/> class.
+        /// 鍒濆鍖�
         /// </summary>
         public UserPage()
         {
             BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
-            ZbGateway.StatusList.Add(this);
-        }
-
-        /// <summary>
-        /// 鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
-        /// </summary>
-        public FrameLayout BodyView = new FrameLayout
-        {
-            Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight),
-            BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor,
-        };
-        /// <summary>
-        /// 鐢ㄦ埛鑿滃崟鐣岄潰锛堝簳閮ㄩ儴鍒嗭級
-        /// </summary>
-        public FrameLayout BottomMenuView = new FrameLayout
-        {
-            Y = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight),
-            Height = Application.GetRealHeight(CommonPage.TabbarHeight),
-            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor,
-        };
-
-        #region 鍒嗗壊绾�
-
-        private Button bottomLine = new Button
-        {
-            Height = 1,
-            BackgroundColor = ZigbeeColor.Current.GXCBottomLineColor
-        };
-
-        #endregion
-
-        #region 搴曢儴-涓婚〉鎸夐挳
-        /// <summary>
-        /// 搴曢儴-涓婚〉鎸夐挳
-        /// </summary>
-        public FrameLayout homePageFL = new FrameLayout
-        {
-            Width = Application.GetRealWidth(tabBarEnum_Width),
-            Height = Application.GetRealHeight(CommonPage.TabbarHeight),
-
-        };
-        /// <summary>
-        /// The home page image.
-        /// </summary>
-        public Button homePageIMG = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumIMG_Y),
-            Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
-            Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
-            UnSelectedImagePath = "Navigation/Home.png",
-            SelectedImagePath = "Navigation/HomeSelected.png",
-            IsSelected = true,
-            Gravity = Gravity.CenterHorizontal
-        };
-        /// <summary>
-        /// The name of the home page.
-        /// </summary>
-        public Button homePageName = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumName_Y),
-            Height = Application.GetRealHeight(tabBarEnumName_Height),
-            TextID = R.MyInternationalizationString.HomePage,
-            TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor,
-            SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2,
-            IsSelected = true,
-            Gravity = Gravity.CenterHorizontal,
-            TextSize = 10
-        };
-        #endregion
-
-        #region 鍒嗙被-搴曢儴鎸夐挳
-        /// <summary>
-        /// 鍒嗙被-搴曢儴鎸夐挳
-        /// </summary>
-        public FrameLayout categoryFL = new FrameLayout
-        {
-            X=Application.GetRealWidth(tabBarEnum_Width),
-            Width = Application.GetRealWidth(tabBarEnum_Width),
-            Height = Application.GetRealHeight(CommonPage.TabbarHeight)
-        };
-        /// <summary>
-        /// The category image.
-        /// </summary>
-        public Button categoryIMG = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumIMG_Y),
-            Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
-            Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
-            UnSelectedImagePath = "Navigation/Category.png",
-            SelectedImagePath = "Navigation/CategorySelected.png",
-            Gravity = Gravity.CenterHorizontal
-        };
-        /// <summary>
-        /// The name of the category.
-        /// </summary>
-        public Button categoryName = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumName_Y),
-            Height = Application.GetRealHeight(tabBarEnumName_Height),
-            TextID = R.MyInternationalizationString.Category,
-            TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor,
-            SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2,
-            IsSelected = false,
-            Gravity = Gravity.CenterHorizontal,
-            TextSize=10
-        };
-        #endregion
-
-        #region 涓汉涓績-搴曢儴鎸夐挳
-        /// <summary>
-        /// 涓汉涓績-搴曢儴鎸夐挳
-        /// </summary>
-        public FrameLayout settingFL = new FrameLayout
-        {
-            X = Application.GetRealWidth(tabBarEnum_Width*2),
-            Width = Application.GetRealWidth(tabBarEnum_Width),
-            Height = Application.GetRealHeight(CommonPage.TabbarHeight)
-        };
-        /// <summary>
-        /// The setting image.
-        /// </summary>
-        public Button settingIMG = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumIMG_Y),
-            Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
-            Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
-            UnSelectedImagePath = "Navigation/Setting.png",
-            SelectedImagePath = "Navigation/SettingSelected.png",
-            Gravity = Gravity.CenterHorizontal
-        };
-        /// <summary>
-        /// 涓汉涓績
-        /// </summary>
-        public Button settingName = new Button
-        {
-            Y = Application.GetRealHeight(tabBarEnumName_Y),
-            Height = Application.GetRealHeight(tabBarEnumName_Height),
-            TextID = R.MyInternationalizationString.Me,
-            TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor,
-            SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2,
-            IsSelected = false,
-            Gravity = Gravity.CenterHorizontal,
-            TextSize = 10
-        };
-        #endregion
-
-
-        EventHandler<MouseEventArgs> BottomEventHandler = (sender, e) =>
-        {
-            Instance.homePageName.IsSelected = false;
-            Instance.homePageIMG.IsSelected = false;
-
-            Instance.categoryName.IsSelected = false;
-            Instance.categoryIMG.IsSelected = false;
-
-            Instance.settingName.IsSelected = false;
-            Instance.settingIMG.IsSelected = false;
-
-            Instance.BodyView.RemoveAll();
-            if (sender == Instance.homePageIMG || sender == Instance.homePageName)
+            Shared.Application.LocationAction += (lon, lat) =>
             {
-                //涓婚〉
-                Instance.homePageName.IsSelected = true;
-                Instance.homePageIMG.IsSelected = true;
-                var home = new UserHomeView { };
-                Instance.BodyView.AddChidren(home);
-                home.Show();
-            }
-            else if (sender == Instance.categoryIMG || sender==Instance.categoryName)
-            {
-                //鍒嗙被
-                Instance.categoryName.IsSelected = true;
-                Instance.categoryIMG.IsSelected = true;
-                var category = new Phone.Device.Category.Category { };
-                Instance.BodyView.AddChidren(category);
-                category.Show();
-            }
-            else if (sender == Instance.settingIMG || sender==Instance.settingName)
-            {
-                 //涓汉涓績
-                Instance.settingName.IsSelected = true;
-                Instance.settingIMG.IsSelected = true;
-                var form = new UserCenter.UserMain.UserMainForm();
-                Instance.BodyView.AddChidren(form);
-                form.ShowForm();
-            }
-        };
-
+                //GPS鍧愭爣杞垚楂樺痉鍧愭爣
+                double out_lng, out_lat;
+                HdlGpsLocationConvertLogic.Current.WGS84_to_GCJ02(lon, lat, out out_lng, out out_lat);
+                //涓婃姤缁忕含搴�
+                Login.AccountLogic.Instance.ReceiveAppLatAndLon(out_lng.ToString(), out_lat.ToString());
+            };
+        }
+
         /// <summary>
-        /// Fresh this instance.
-        /// </summary>
-        public void Fresh()
-        {
-            BottomEventHandler(Instance.homePageIMG, null);
-        }
-
-        /// <summary>
-        /// Inits the page.
+        /// 鍒濆鍖�
         /// </summary>
         public void InitPage()
         {
-            if (0 < ChildrenCount)
+            if (this.ChildrenCount > 0)
             {
                 return;
+            }
+#if iOS
+            if (Shared.Application.IsFullScreen == true)
+            {
+                //楂樼増鏈殑鑻规灉鏈哄瀷锛屽睆骞曞簳閮ㄤ細鏈変竴涓粦鑹茬殑鏉�
+                ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(180);
+            }
+#endif
+            //鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
+            this.bodyFrameView = new NormalFrameLayout();
+            bodyFrameView.Height = this.Height - UserCenter.ControlCommonResourse.BottomFrameHeight;
+            bodyFrameView.BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
+            this.AddChidren(bodyFrameView);
+
+            //鐢ㄦ埛鑿滃崟鐣岄潰锛堝簳閮ㄩ儴鍒嗭級
+            var bottomMenuFrame = new FrameLayout();
+            bottomMenuFrame.Gravity = Gravity.BottomCenter;
+            bottomMenuFrame.Height = ControlCommonResourse.BottomFrameHeight;
+            bottomMenuFrame.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor;
+            this.AddChidren(bottomMenuFrame);
+            //搴曢儴鑿滃崟鐨勫ご閮ㄧ嚎
+            var bottomLine = new NormalViewControl(bottomMenuFrame.Width, ControlCommonResourse.BottomLineHeight, false);
+            bottomLine.BackgroundColor = 0xffc8c8c9;
+            bottomMenuFrame.AddChidren(bottomLine);
+
+            //涓婚〉瀹瑰櫒
+            var frameHomePage = new FrameLayout();
+            frameHomePage.Width = bottomMenuFrame.Width / 3;
+            frameHomePage.Height = bottomMenuFrame.Height;
+            bottomMenuFrame.AddChidren(frameHomePage);
+            //涓婚〉鍥炬爣
+            var btnHomeIcon = new PicViewControl(138, 98);
+            btnHomeIcon.Y = Application.GetRealHeight(3);
+            btnHomeIcon.UnSelectedImagePath = "Navigation/Home.png";
+            btnHomeIcon.SelectedImagePath = "Navigation/HomeSelected.png";
+            btnHomeIcon.Gravity = Gravity.CenterHorizontal;
+            frameHomePage.AddChidren(btnHomeIcon);
+            this.listButton.Add(btnHomeIcon);
+            btnHomeIcon.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, true);
+            };
+            //涓婚〉
+            var btnHomeName = new NormalViewControl(btnHomeIcon.Width, Application.GetRealHeight(40), false);
+            btnHomeName.Y = btnHomeIcon.Bottom;
+            btnHomeName.TextID = R.MyInternationalizationString.HomePage;
+            btnHomeName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+            btnHomeName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+            btnHomeName.TextSize = 10;
+            btnHomeName.Gravity = Gravity.CenterHorizontal;
+            btnHomeName.TextAlignment = TextAlignment.Center;
+            frameHomePage.AddChidren(btnHomeName);
+            this.listButton.Add(btnHomeName);
+            btnHomeName.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, true);
+            };
+
+            //鍒嗙被瀹瑰櫒
+            var frameCategory = new FrameLayout();
+            frameCategory.X = frameHomePage.Right;
+            frameCategory.Width = bottomMenuFrame.Width / 3;
+            frameCategory.Height = bottomMenuFrame.Height;
+            bottomMenuFrame.AddChidren(frameCategory);
+            //鍒嗙被鍥炬爣
+            var btnCategoryIcon = new PicViewControl(138, 98);
+            btnCategoryIcon.Y = Application.GetRealHeight(3);
+            btnCategoryIcon.UnSelectedImagePath = "Navigation/Category.png";
+            btnCategoryIcon.SelectedImagePath = "Navigation/CategorySelected.png";
+            btnCategoryIcon.Gravity = Gravity.CenterHorizontal;
+            frameCategory.AddChidren(btnCategoryIcon);
+            this.listButton.Add(btnCategoryIcon);
+            btnCategoryIcon.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A鍒嗙被, true);
+            };
+            //鍒嗙被
+            var btnCategoryName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
+            btnCategoryName.Y = btnCategoryIcon.Bottom;
+            btnCategoryName.TextID = R.MyInternationalizationString.Category;
+            btnCategoryName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+            btnCategoryName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+            btnCategoryName.TextSize = 10;
+            btnCategoryName.Gravity = Gravity.CenterHorizontal;
+            btnCategoryName.TextAlignment = TextAlignment.Center;
+            frameCategory.AddChidren(btnCategoryName);
+            this.listButton.Add(btnCategoryName);
+            btnCategoryName.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A鍒嗙被, true);
+            };
+
+
+            //鎴戠殑瀹瑰櫒
+            var frameSetting = new FrameLayout();
+            frameSetting.X = frameCategory.Right;
+            frameSetting.Width = bottomMenuFrame.Width / 3;
+            frameSetting.Height = bottomMenuFrame.Height;
+            bottomMenuFrame.AddChidren(frameSetting);
+            //鎴戠殑鍥炬爣
+            var btnSettingIcon = new PicViewControl(138, 98);
+            btnSettingIcon.Y = Application.GetRealHeight(3);
+            btnSettingIcon.UnSelectedImagePath = "Navigation/Setting.png";
+            btnSettingIcon.SelectedImagePath = "Navigation/SettingSelected.png";
+            btnSettingIcon.Gravity = Gravity.CenterHorizontal;
+            frameSetting.AddChidren(btnSettingIcon);
+            this.listButton.Add(btnSettingIcon);
+            btnSettingIcon.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A涓汉涓績, true);
+            };
+            //鎴戠殑
+            var btnSettingName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
+            btnSettingName.Y = btnSettingIcon.Bottom;
+            btnSettingName.TextID = R.MyInternationalizationString.Me;
+            btnSettingName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+            btnSettingName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+            btnSettingName.TextSize = 10;
+            btnSettingName.Gravity = Gravity.CenterHorizontal;
+            btnSettingName.TextAlignment = TextAlignment.Center;
+            frameSetting.AddChidren(btnSettingName);
+            this.listButton.Add(btnSettingName);
+            btnSettingName.ButtonClickEvent += (sender, e) =>
+            {
+                this.BottomMenuClickEvent(MenuSelectEnum.A涓汉涓績, true);
+            };
+        }
+
+        /// <summary>
+        /// 鍒锋柊鎺т欢
+        /// </summary>
+        public void ReFreshControl()
+        {
+            //杩欓噷鍋氬叏鍒锋柊澶勭悊
+            this.listForm = new List<EditorCommonForm>() { null, null, null };
+            this.bodyFrameView.RemoveAll();
+
+            this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, false);
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 搴曢儴鑿滃崟鐨勭偣鍑讳簨浠�
+        /// </summary>
+        /// <param name="selectEnum">鑿滃崟閫夋嫨鏋氫妇</param>
+        /// <param name="handClick">鏄惁鏄墜鍔ㄧ偣鍑�</param>
+        private void BottomMenuClickEvent(MenuSelectEnum selectEnum, bool handClick)
+        {
+            if (this.RefreshAllForm == false && selectEnum == this.nowSelectMenu && handClick == true)
+            {
+                //鎵嬪姩鐐瑰嚮鍚屼竴涓彍鍗�,鍒欎笉鍋氬鐞�
+                return;
+            }
+
+            //濡傛灉寮哄埗鎸囧畾鍒锋柊鐣岄潰鐨勮瘽
+            if (this.RefreshAllForm == true)
+            {
+                //鍏ㄩ儴鍒锋柊
+                this.listForm = new List<EditorCommonForm>() { null, null, null };
+                this.bodyFrameView.RemoveAll();
+
+                this.RefreshAllForm = false;
+            }
+
+            this.nowSelectMenu = selectEnum;
+
+            //涓婚〉
+            if (selectEnum == MenuSelectEnum.A涓婚〉)
+            {
+                //宸︽粦鑿滃崟鍙�
+                CommonPage.Instance.IsDrawerLockMode = false;
+                if (this.RefreshMainPageForm == true)
+                {
+                    //鍒锋柊涓婚〉
+                    listForm[0]?.CloseForm();
+                    listForm[0] = null;
+                    this.RefreshMainPageForm = false;
+                }
+                if (listForm[0] == null)
+                {
+                    var form = new MainPage.HomeMainPageForm();
+                    this.bodyFrameView.AddChidren(form);
+                    form.ShowForm();
+                    //鍔犵紦瀛�
+                    listForm[0] = form;
+                }
             }
-
-            AddChidren(BodyView);
-            AddChidren(BottomMenuView);
-
-            BottomMenuView.AddChidren(Instance.bottomLine);
-
-            Instance.homePageFL.AddChidren(Instance.homePageIMG);
-            Instance.homePageFL.AddChidren(Instance.homePageName);
-            BottomMenuView.AddChidren(Instance.homePageFL);
-
-            Instance.categoryFL.AddChidren(Instance.categoryIMG);
-            Instance.categoryFL.AddChidren(Instance.categoryName);
-            BottomMenuView.AddChidren(Instance.categoryFL);
-
-            Instance.settingFL.AddChidren(Instance.settingIMG);
-            Instance.settingFL.AddChidren(Instance.settingName);
-            BottomMenuView.AddChidren(Instance.settingFL);
-
-            homePageIMG.MouseUpEventHandler += BottomEventHandler;
-            homePageName.MouseUpEventHandler += BottomEventHandler;
-
-            categoryIMG.MouseUpEventHandler += BottomEventHandler;
-            categoryName.MouseUpEventHandler += BottomEventHandler;
-
-            settingIMG.MouseUpEventHandler += BottomEventHandler;
-            settingName.MouseUpEventHandler += BottomEventHandler;
-        }
+            else if (selectEnum == MenuSelectEnum.A鍒嗙被)
+            {
+                //宸︽粦鑿滃崟涓嶅彲
+                CommonPage.Instance.IsDrawerLockMode = true;
+                if (this.RefreshCategoryForm == true)
+                {
+                    //鍒锋柊鍒嗙被
+                    listForm[1]?.CloseForm();
+                    listForm[1] = null;
+                    this.RefreshCategoryForm = false;
+                }
+                if (listForm[1] == null)
+                {
+                    var form = new Category.CategoryMainForm();
+                    this.bodyFrameView.AddChidren(form);
+                    form.ShowForm();
+                    //鍔犵紦瀛�
+                    listForm[1] = form;
+                }
+            }
+            else if (selectEnum == MenuSelectEnum.A涓汉涓績)
+            {
+                //宸︽粦鑿滃崟涓嶅彲
+                CommonPage.Instance.IsDrawerLockMode = true;
+                if (listForm[2] == null)
+                {
+                    var form = new UserCenter.UserMain.UserMainForm();
+                    this.bodyFrameView.AddChidren(form);
+                    form.ShowForm();
+                    //鍔犵紦瀛�
+                    listForm[2] = form;
+                }
+            }
+            //璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+            this.SetAllControlStatu();
+        }
+
+        /// <summary>
+        /// 璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+        /// </summary>
+        private void SetAllControlStatu()
+        {
+            int index = (int)this.nowSelectMenu - 1;
+            for (int i = 0; i < listForm.Count; i++)
+            {
+                if (i == index)
+                {
+                    //褰撳墠閫夋嫨鐨勮彍鍗曠殑璇�,鍒欏叏閮ㄥ彲瑙�
+                    listForm[i].Visible = true;
+                    //鎺т欢鍥剧墖鍜岄鑹插彉鏇�
+                    this.listButton[i * 2].IsSelected = true;
+                    this.listButton[i * 2 + 1].IsSelected = true;
+                }
+                else
+                {
+                    //涓嶆槸褰撳墠閫夋嫨鐨勮彍鍗曠殑璇�,鍏ㄩ儴涓嶅彲瑙�
+                    if (listForm[i] != null)
+                    {
+                        listForm[i].Visible = false;
+                    }
+                    //鎺т欢鍥剧墖鍜岄鑹插彉鏇�
+                    this.listButton[i * 2].IsSelected = false;
+                    this.listButton[i * 2 + 1].IsSelected = false;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈�
+        /// </summary>
+        public void ShowCategoryAutoListForm()
+        {
+            //鍏抽棴鍏ㄩ儴鐣岄潰,鐩村埌涓婚〉涓烘
+            UserCenterLogic.CloseAllOpenForm(null, false);
+            //寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈�
+            UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2;
+
+            this.nowSelectMenu = MenuSelectEnum.A鍒嗙被;
+
+            //宸︽粦鑿滃崟涓嶅彲
+            CommonPage.Instance.IsDrawerLockMode = true;
+            if (listForm[1] == null)
+            {
+                var form = new Category.CategoryMainForm();
+                this.bodyFrameView.AddChidren(form);
+                form.ShowForm();
+                //鍔犵紦瀛�
+                listForm[1] = form;
+            }
+            else
+            {
+                ((Category.CategoryMainForm)listForm[1]).RefreshBodyView();
+            }
+            //璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+            this.SetAllControlStatu();
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠婵�娲荤殑鐣岄潰
+        /// </summary>
+        /// <returns></returns>
+        public EditorCommonForm GetNowActionForm()
+        {
+            int index = ((int)this.nowSelectMenu) - 1;
+            if (index != -1)
+            {
+                //璋冪敤姝ょ晫闈㈢殑婵�娲诲嚱鏁�
+                return this.listForm[index];
+            }
+            return null;
+        }
+
+        #endregion
+
+        #region 鈻� 缁撴瀯浣揰____________________________
+
+        /// <summary>
+        /// 鑿滃崟閫夋嫨鐨勬灇涓�
+        /// </summary>
+        private enum MenuSelectEnum
+        {
+            A鏈�夋嫨 = 0,
+            A涓婚〉 = 1,
+            A鍒嗙被 = 2,
+            A涓汉涓績 = 3
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0