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/Device/Logic/AddLogicPage.cs | 1299 ++++++++++------------------------------------------------
 1 files changed, 233 insertions(+), 1,066 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
index 8f89c08..0992fcf 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -1,14 +1,16 @@
-锘�       using System;
+锘縰sing System;
 using System.Collections.Generic;
 using Shared;
 using Shared.Common;
 using Shared.Phone.Device;
 using Shared.R;
 using ZigBee.Device;
+using Shared.Phone.Device.Logic.LogicView;
+
 
 namespace Shared.Phone.Device.Logic
 {
-    
+
     public class AddLogicPage : FrameLayout
     {
         public AddLogicPage()
@@ -17,356 +19,74 @@
         }
         public void Show()
         {
-
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
+          
+            #region  鐣岄潰鐨勫竷灞�浠g爜
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            view.toptitleNameBtn.TextID = MyInternationalizationString.selection;
+            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
+           
+            var middle = new FrameLayout
             {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
-            };
-            this.AddChidren(topRowLayout);
-
-            var titleName = new Button {
-                TextSize = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(600),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.selection,
-            };
-            topRowLayout.AddChidren(titleName);
-
-            var clickBtn = new Button
-            {
-                Width = Application.GetRealWidth(81 + 51),
-                Height = Application.GetRealHeight(58 + 40),
-                Y = Application.GetRealHeight(98 - 40),
-            };
-            topRowLayout.AddChidren(clickBtn);
-            clickBtn.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
-
-            var back = new Button
-            {
-                Width = Application.GetRealWidth(30),
-                Height = Application.GetRealHeight(51),
-                X = Application.GetRealWidth(81),
-                Y = Application.GetRealHeight(98),
-                //Gravity = Gravity.CenterVertical;
-                UnSelectedImagePath = "ZigeeLogic/back.png",
-            };
-            topRowLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) => {
-                RemoveFromParent();
-            };
-            #endregion
-
-            #region  鏈�涓嬮潰鐨勫竷灞�浠g爜
-            var middle = new FrameLayout {
-                Y = topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184),
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
+            ///鏃堕棿
+            FunView timeView = new FunView();
+            timeView.iconBtn.UnSelectedImagePath = "ZigeeLogic/time.png";
+            timeView.funnameBtn.TextID = MyInternationalizationString.timecondition;
+            middle.AddChidren(timeView.FunFrameView());
+          
+            ///璁惧
+            FunView functionView = new FunView();
+            functionView.funFrameLayout.Y = timeView.funFrameLayout.Bottom;
+            functionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png";
+            functionView.funnameBtn.TextID = MyInternationalizationString.device;
+            middle.AddChidren(functionView.FunFrameView());
+          
+            ///瀹夐槻
+            FunView securityView = new FunView();
+            securityView.funFrameLayout.Y = functionView.funFrameLayout.Bottom;
+            securityView.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png";
+            securityView.funnameBtn.TextID = MyInternationalizationString.security;
+            middle.AddChidren(securityView.FunFrameView());
+    
+            ///鍦扮悊鍥存爮
+            FunView positionView = new FunView();
+            positionView.funFrameLayout.Y = securityView.funFrameLayout.Bottom;
+            positionView.funFrameLayout.Height = Application.GetRealHeight(160+20);//鏈�鍚庝竴琛屽鍔�20楂樺害;
+            positionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/position.png";
+            positionView.funnameBtn.TextID = MyInternationalizationString.location;
+            positionView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
+            middle.AddChidren(positionView.FunFrameView());
+            #endregion
 
-            #region   ----鏃堕棿鏉′欢----
-            var timeframelayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            middle.AddChidren(timeframelayout);
-
-
-            var timeiconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-                UnSelectedImagePath = "ZigeeLogic/time.png",
-
-            };
-            timeframelayout.AddChidren(timeiconBtn);
-
-            var timerow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            timeframelayout.AddChidren(timerow);
-            ///鏃堕棿鏉′欢
-            var btntime = new Button {
-                Text = Language.StringByID(MyInternationalizationString.timecondition),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize=15,
-            };
-            timerow.AddChidren(btntime);
-
-            var btntimeback = new Button {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
-            };
-            timerow.AddChidren(btntimeback);
-
-            EventHandler<MouseEventArgs> timeclick = (sender, e) =>
+            timeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
                 TimeView();
             };
-            btntime.MouseUpEventHandler += timeclick;
-            btntimeback.MouseUpEventHandler += timeclick;
-            timeframelayout.MouseUpEventHandler += timeclick;
-            timeiconBtn.MouseUpEventHandler += timeclick;
-            timerow.MouseUpEventHandler += timeclick;
-
-            #endregion
-
-            #region   ----璁惧鐘舵�佹潯浠�----
-            var deviceframelayout = new FrameLayout
+            functionView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Height = Application.GetRealHeight(160),
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                Y = timeframelayout.Bottom,
-            };
-            middle.AddChidren(deviceframelayout);
-
-            var deviceiconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-                UnSelectedImagePath = "ZigeeLogic/function.png",
-
-            };
-            deviceframelayout.AddChidren(deviceiconBtn);
-
-            var devicerow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            deviceframelayout.AddChidren(devicerow);
-
-
-            ///璁惧鐘舵�佹潯浠�
-            var btndevice = new Button {
-                //Text = "璁惧鐘舵�佹潯浠�",
-                TextID = MyInternationalizationString.device,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize = 15,
-            };
-            devicerow.AddChidren(btndevice);
-
-            var btndeviceback = new Button {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-
-            };
-            devicerow.AddChidren(btndeviceback);
-
-            EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
-            {
-                var deviceStateCondition = new DeviceStateCondition();
-                UserView.HomePage.Instance.AddChidren(deviceStateCondition);
+                var roomAndDeviceView = new RoomAndDeviceView();
+                UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
                 UserView.HomePage.Instance.PageIndex += 1;
-                deviceStateCondition.Show();
-            };
-            deviceframelayout.MouseUpEventHandler += devicestateclick;
-            btndevice.MouseUpEventHandler += devicestateclick;
-            btndeviceback.MouseUpEventHandler += devicestateclick;
-            deviceiconBtn.MouseUpEventHandler += devicestateclick;
-            devicerow.MouseUpEventHandler += devicestateclick;
-            #endregion
+                roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic;
+                roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate));
 
-            #region   ----瀹夐槻鏉′欢----
-            var securityframelayout = new FrameLayout
+            };
+            securityView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Height = Application.GetRealHeight(160),
-                Y = deviceframelayout.Bottom,
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                SecurityView(this,false);
             };
-            middle.AddChidren(securityframelayout);
-
-            var securityiconBtn = new Button
+            positionView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                UnSelectedImagePath = "ZigeeLogic/security.png",
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
+              
+                LocationView(this, false);
             };
-            securityframelayout.AddChidren(securityiconBtn);
-
-            var securityrow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            securityframelayout.AddChidren(securityrow);
-
-
-            var btnsecurity = new Button
-            {
-                //Text = "瀹夐槻鏉′欢",
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = MyInternationalizationString.security,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize = 15,
-            };
-            securityrow.AddChidren(btnsecurity);
-
-            var btnsecurityback = new Button
-            {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
-            };
-            securityrow.AddChidren(btnsecurityback);
-
-            EventHandler<MouseEventArgs> securityclick = (sender, e) =>
-            {
-                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                this.AddChidren(flMain);
-                SecurityView(flMain, false);
-            };
-            securityframelayout.MouseUpEventHandler += securityclick;
-            btnsecurity.MouseUpEventHandler += securityclick;
-            btnsecurityback.MouseUpEventHandler += securityclick;
-            securityiconBtn.MouseUpEventHandler += securityclick;
-            securityrow.MouseUpEventHandler += securityclick;
-            #endregion
-
-            #region   ----鍦扮悊鍥存爮鏉′欢----
-            var locationframelayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = securityframelayout.Bottom,
-                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            middle.AddChidren(locationframelayout);
-
-            var locationiconBtn = new Button
-            {
-                Width = Application.GetRealWidth(81),
-                Height = Application.GetRealHeight(81),
-                UnSelectedImagePath = "ZigeeLogic/position.png",
-                X = Application.GetRealWidth(58),
-                Y = Application.GetRealHeight(55),
-            };
-            locationframelayout.AddChidren(locationiconBtn);
-
-            var locationrow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(850),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(176),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            locationframelayout.AddChidren(locationrow);
-
-            var btnlocation = new Button
-            {
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = MyInternationalizationString.location,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize = 15,
-            };
-            locationrow.AddChidren(btnlocation);
-
-            var btnlocationback = new Button
-            {
-                Width = Application.GetRealWidth(58),
-                Height = Application.GetRealHeight(58),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                X = Application.GetRealWidth(789),
-                Gravity = Gravity.CenterVertical,
-            };
-            locationrow.AddChidren(btnlocationback);
-
-            EventHandler<MouseEventArgs> locationclick = (sender, e) =>
-            {
-                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                this.AddChidren(flMain);
-                LocationView(flMain, false);
-            };
-            locationframelayout.MouseUpEventHandler += locationclick;
-            locationiconBtn.MouseUpEventHandler += locationclick;
-            locationrow.MouseUpEventHandler += locationclick;
-            btnlocation.MouseUpEventHandler += locationclick;
-            btnlocationback.MouseUpEventHandler += locationclick;
-            #endregion
-
-            #region   ----宸叉湁鑷姩鍖栨潯浠�----
-            var existencerowlayout = new RowLayout {
-                Height = Application.GetRealHeight(180),
-                Y = securityframelayout.Bottom,
-            };
-            //middle.AddChidren (existencerowlayout);
-            ///宸叉湁鑷姩鍖栨潯浠�
-            var btnexistence = new Button
-            {
-                //Text = "宸叉湁鑷姩鍖栨潯浠�",
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(60),
-                TextID = MyInternationalizationString.automation,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextSize = 15,
-            };
-            existencerowlayout.AddChidren(btnexistence);
-
-            var btnexistenceback = new Button {
-                Width = Application.GetRealWidth(110),
-                Height = Application.GetRealHeight(110),
-                UnSelectedImagePath = "ZigeeLogic/next.png",
-                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
-                X = Application.GetRealWidth(1080 - 140),
-                Gravity = Gravity.CenterVertical,
-            };
-            existencerowlayout.AddChidren(btnexistenceback);
-
-            EventHandler<MouseEventArgs> logicclick = (sender, e) => {
-                var logicListAutomation = new LogicListAutomation();
-                UserView.HomePage.Instance.AddChidren(logicListAutomation);
-                UserView.HomePage.Instance.PageIndex += 1;
-                logicListAutomation.Show();
-            };
-            btnexistenceback.MouseUpEventHandler += logicclick;
-            btnexistence.MouseUpEventHandler += logicclick;
-            existencerowlayout.MouseUpEventHandler += logicclick;
-            #endregion
-
-
-
-            #endregion
-
         }
-       
+
         /// <summary>
         /// 瀹夐槻鏉′欢View
         /// </summary>
@@ -374,335 +94,90 @@
         /// <param name="edit">If set to <c>true</c> edit.</param>
         public static void SecurityView(FrameLayout flMain, bool edit)
         {
-            UserView.HomePage.Instance.ScrollEnabled = false;
-            Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
-            //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-            //this.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender12, e12) =>
-            {
-                flMain.RemoveFromParent();
-            };
-
-          
-            var securityfra = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(690),
-                Y = Application.GetRealHeight(1920 - 690),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                //Radius = (uint)Application.GetRealHeight(60),
-            };
-            flMain.AddChidren(securityfra);
-            securityfra.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
-            #region  -------鍙栨秷   瀹屾垚
-            var timetype = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            securityfra.AddChidren(timetype);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 14,
-            };
-            timetype.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
-                UserView.HomePage.Instance.ScrollEnabled = true;
-            };
-
-            var Btntitle = new Button
-            {
-                TextID = MyInternationalizationString.security,
-                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(320),
-                TextAlignment = TextAlignment.Center,
-                X = Btncancel.Right + Application.GetRealWidth(100),
-                TextSize = 16,
-            };
-            timetype.AddChidren(Btntitle);
-            var Btncomplete = new Button
-            {
-                TextID = MyInternationalizationString.complete,
-                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                TextAlignment = TextAlignment.CenterRight,
-                X = Btntitle.Right + Application.GetRealWidth(100),
-                TextSize = 14,
-
-            };
-            timetype.AddChidren(Btncomplete);
-            #endregion
-
-
-            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻
-
-            #region  鍦ㄥ甯冮槻
-
-
-            var athomeFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timetype.Bottom + Application.GetRealHeight(20),
-            };
-            securityfra.AddChidren(athomeFrameLayout);
-
-            var athomedefenceRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            athomeFrameLayout.AddChidren(athomedefenceRowLayout);
-
-            var btnathomedefence = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.logicathomegarrison,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-            };
-            athomedefenceRowLayout.AddChidren(btnathomedefence);
-
-
-            var athomedefenceSelected = new SelectedButton();
-            athomedefenceRowLayout.AddChidren(athomedefenceSelected);
-
-            #endregion
-            #region  绂诲甯冮槻
-
-            var leavehomeFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = athomeFrameLayout.Bottom,
-            };
-            securityfra.AddChidren(leavehomeFrameLayout);
-
-            var leavehomedefenceRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            leavehomeFrameLayout.AddChidren(leavehomedefenceRowLayout);
-
-            var leavehomebtndefence = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.logicremovehomegarrison,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-            };
-            leavehomedefenceRowLayout.AddChidren(leavehomebtndefence);
-            var leavehomedefenceSelected = new SelectedButton();
-            leavehomedefenceRowLayout.AddChidren(leavehomedefenceSelected);
-            #endregion
-            #region  鎾ら槻
-            var withdrawalFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = leavehomeFrameLayout.Bottom,
-            };
-            securityfra.AddChidren(withdrawalFrameLayout);
-
-
-            var withdrawalRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            withdrawalFrameLayout.AddChidren(withdrawalRowLayout);
-
-            var btnwithdrawal = new Button
-            {
-
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.withdrawal,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-            };
-            withdrawalRowLayout.AddChidren(btnwithdrawal);
-            var withdrawalSelected = new SelectedButton();
-            withdrawalRowLayout.AddChidren(withdrawalSelected);
-            #endregion
-
-            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻鐐瑰嚮浜嬩欢
-            ///鍦ㄥ甯冮槻鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> athomeclick = (sedner14, e14) =>
-            {
-                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                athomedefenceSelected.Visible = true;
-                leavehomedefenceSelected.Visible = false;
-                withdrawalSelected.Visible = false;
-            };
-            athomedefenceRowLayout.MouseUpEventHandler += athomeclick;
-            btnathomedefence.MouseUpEventHandler += athomeclick;
-            athomedefenceSelected.MouseUpEventHandler += athomeclick;
-            athomeFrameLayout.MouseUpEventHandler += athomeclick;
-
-            ///绂诲甯冮槻鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) =>
-            {
-                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                athomedefenceSelected.Visible = false;
-                leavehomedefenceSelected.Visible = true;
-                withdrawalSelected.Visible = false;
-            };
-            leavehomedefenceRowLayout.MouseUpEventHandler += leavehomeclick;
-            leavehomebtndefence.MouseUpEventHandler += leavehomeclick;
-            leavehomedefenceSelected.MouseUpEventHandler += leavehomeclick;
-            leavehomeFrameLayout.MouseUpEventHandler += leavehomeclick;
-            ///鎾ら槻鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> disableclick = (sedner15, e15) =>
-            {
-                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                athomedefenceSelected.Visible = false;
-                leavehomedefenceSelected.Visible = false;
-                withdrawalSelected.Visible = true;
-            };
-            withdrawalRowLayout.MouseUpEventHandler += disableclick;
-            btnwithdrawal.MouseUpEventHandler += disableclick;
-            withdrawalSelected.MouseUpEventHandler += disableclick;
-            withdrawalFrameLayout.MouseUpEventHandler += disableclick;
-            #endregion
-            #endregion
-
-
+         
+            string stateText = "";
             if (edit)
             {
                 foreach (var securityifon in Common.Logic.CurrentLogic.Conditions)
                 {
-
                     if (securityifon["Type"] == "6")
                     {
-                        if (securityifon["EnOrWithdrawMode"] == "0")
+                        switch (securityifon["EnOrWithdrawMode"])
                         {
-                            if (securityifon["ModeId"] == "1")
-                            {
-                                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                                athomedefenceSelected.Visible = true;
-                                leavehomedefenceSelected.Visible = false;
-                                withdrawalSelected.Visible = false;
-                            }
-                            else
-                            {
-                                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                                athomedefenceSelected.Visible = false;
-                                leavehomedefenceSelected.Visible = true;
-                                withdrawalSelected.Visible = false;
-                            }
-
-
+                            case "0":
+                                {
+                                    if (securityifon["ModeId"] == "1")
+                                    {
+                                        stateText = Language.StringByID(MyInternationalizationString.logicathomegarrison);
+                                    }
+                                    else
+                                    {
+                                        stateText = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
+                                    }
+                                }
+                                break;
+                            case "1":
+                                {
+                                    stateText = Language.StringByID(MyInternationalizationString.withdrawal);
+                                }
+                                break;
+                            case "2":
+                                {
+                                    stateText = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
+                                }
+                                break;
                         }
-                        else
-                        {
-                            btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                            leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                            btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                            athomedefenceSelected.Visible = false;
-                            leavehomedefenceSelected.Visible = false;
-                            withdrawalSelected.Visible = true;
-                        }
-                        break;
                     }
                 }
             }
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
+            PublicInterface publicInterface = new PublicInterface();
+             var list=publicInterface.GetViewList("瀹夐槻");
+            publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.security, stateText, (str) =>
             {
-                if (!athomedefenceSelected.Visible && !leavehomedefenceSelected.Visible && !withdrawalSelected.Visible)
-                {
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                if (SecurityConditionsInfo.ContainsKey("Type"))
-                {
-                    SecurityConditionsInfo.Remove("Type");
-                }
-                if (SecurityConditionsInfo.ContainsKey("IsValid"))
-                {
-                    SecurityConditionsInfo.Remove("IsValid");
-                }
-                if (SecurityConditionsInfo.ContainsKey("ModeId"))
-                {
-                    SecurityConditionsInfo.Remove("ModeId");
-                }
-
-                SecurityConditionsInfo.Add("Type", "6");
-                SecurityConditionsInfo.Add("IsValid", "1");
-                SecurityConditionsInfo.Add("ModeId", "0");
+                string EnOrWithdrawMode = "";
+                string ModeId = "";
                 //鍦ㄥ甯冮槻
-                if (athomedefenceSelected.Visible)
+                if (str == Language.StringByID(MyInternationalizationString.logicathomegarrison))
                 {
-                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
-                    {
-                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
-                    }
-                    if (SecurityConditionsInfo.ContainsKey("ModeId"))
-                    {
-                        SecurityConditionsInfo.Remove("ModeId");
-                    }
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
-                    SecurityConditionsInfo.Add("ModeId", "1");
+                    EnOrWithdrawMode = "0";
+                    ModeId = "1";
+
                 }
                 //绂诲甯冮槻
-                if (leavehomedefenceSelected.Visible)
+                else if (str == Language.StringByID(MyInternationalizationString.logicremovehomegarrison))
                 {
-                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
-                    {
-                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
-                    }
-                    if (SecurityConditionsInfo.ContainsKey("ModeId"))
-                    {
-                        SecurityConditionsInfo.Remove("ModeId");
-                    }
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
-                    SecurityConditionsInfo.Add("ModeId", "2");
+                    EnOrWithdrawMode = "0";
+                    ModeId = "2";
+
                 }
                 //鎾ら槻
-                if (withdrawalSelected.Visible)
+                else if (str == Language.StringByID(MyInternationalizationString.withdrawal))
                 {
-                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
-                    {
-                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
-                    }
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "1");
+                    EnOrWithdrawMode = "1";
+                    ModeId = "0";
+
                 }
-                LogicIfon.AddSecurityconditions(SecurityConditionsInfo);
+                //鑳佽揩鎾ら槻
+                else if (str == Language.StringByID(MyInternationalizationString.urgentwithdrawal))
+                {
+                    EnOrWithdrawMode = "2";
+                    ModeId = "0";
+
+                }
+
+                var securityConditions = new Dictionary<string, string>();  
+                securityConditions.Add("Type", "6");
+                securityConditions.Add("IsValid", "1");
+                securityConditions.Add("EnOrWithdrawMode", EnOrWithdrawMode); 
+                securityConditions.Add("ModeId", ModeId);
+
+                LogicIfon.AddSecurityconditions(securityConditions);
                 var logicCommunalPage = new LogicCommunalPage();
                 UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                 UserView.HomePage.Instance.PageIndex += 1;
                 logicCommunalPage.Show(() => { });
-            };
 
+            });
         }
         /// <summary>
         /// 鍦扮悊鍥存爮View
@@ -711,279 +186,140 @@
         /// <param name="edit">If set to <c>true</c> edit.</param>
         public static void LocationView(FrameLayout flMain, bool edit)
         {
-            UserView.HomePage.Instance.ScrollEnabled = false;
-            Dictionary<string, string> LocationConditionsInfo = new Dictionary<string, string>();
-            //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-            //this.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender12, e12) =>
-            {
-                flMain.RemoveFromParent();
-            };
-
-
-            var Locationfra = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(530),
-                Y = Application.GetRealHeight(1920 - 530),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-                //Radius = (uint)Application.GetRealHeight(60),
-            };
-            flMain.AddChidren(Locationfra);
-            Locationfra.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
-
-            #region  -------鍙栨秷   瀹屾垚
-            var typeRow = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            Locationfra.AddChidren(typeRow);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 14,
-            };
-            typeRow.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
-                UserView.HomePage.Instance.ScrollEnabled = true;
-            };
-
-            var Btntitle = new Button
-            {
-                TextID = MyInternationalizationString.location,
-                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(320),
-                TextAlignment = TextAlignment.Center,
-                X = Btncancel.Right + Application.GetRealWidth(100),
-                TextSize = 16,
-            };
-            typeRow.AddChidren(Btntitle);
-            var Btncomplete = new Button
-            {
-                TextID = MyInternationalizationString.complete,
-                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                TextAlignment = TextAlignment.CenterRight,
-                X = Btntitle.Right + Application.GetRealWidth(100),
-                TextSize = 14,
-
-            };
-            typeRow.AddChidren(Btncomplete);
-            #endregion
-
-            #region  ------鍦ㄥ   绂诲  
-            #region ------鍦ㄥ
-
-            var athomeFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = typeRow.Bottom + Application.GetRealHeight(20),
-            };
-            Locationfra.AddChidren(athomeFrameLayout);
-
-            var athomeRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            athomeFrameLayout.AddChidren(athomeRowLayout);
-
-            var btnathome = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.athome,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-
-
-            };
-            athomeRowLayout.AddChidren(btnathome);
-            var athomeSelected = new SelectedButton();
-            athomeRowLayout.AddChidren(athomeSelected);
-            #endregion
-
-            #region -------绂诲 
-            var leavehomeFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = athomeFrameLayout.Bottom,
-            };
-            Locationfra.AddChidren(leavehomeFrameLayout);
-
-            var leavehomeRowLayout = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-            };
-            leavehomeFrameLayout.AddChidren(leavehomeRowLayout);
-
-            var btnleavehome = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.leavehome,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                TextSize = 14,
-            };
-            leavehomeRowLayout.AddChidren(btnleavehome);
-            var leavehomeSelected = new SelectedButton();
-            leavehomeRowLayout.AddChidren(leavehomeSelected);
-            #endregion
-
-            #endregion
             string strname = "";
-            ///鍦ㄥ鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) =>
-            {
-                strname = btnathome.Text;
-                btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                leavehomeSelected.Visible = false;
-                athomeSelected.Visible = true;
-
-
-            };
-            btnathome.MouseUpEventHandler += athomeclick;
-            athomeSelected.MouseUpEventHandler += athomeclick;
-            athomeRowLayout.MouseUpEventHandler += athomeclick;
-            athomeFrameLayout.MouseUpEventHandler += athomeclick;
-
-            ///绂诲鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) =>
-            {
-                strname = btnleavehome.Text;
-                btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                btnathome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                leavehomeSelected.Visible = true;
-                athomeSelected.Visible = false;
-            };
-            btnleavehome.MouseUpEventHandler += leavehomeclick;
-            leavehomeSelected.MouseUpEventHandler += leavehomeclick;
-            leavehomeRowLayout.MouseUpEventHandler += leavehomeclick;
-            leavehomeFrameLayout.MouseUpEventHandler += leavehomeclick;
-
+            double latitude = Config.Instance.Home.Latitude;//绾害
+            double longitude = Config.Instance.Home.Longitude;//缁忓害
+            int r = 500;//鍗婂緞
             if (edit)
             {
+                string guid = "";
                 foreach (var Locationifon in Common.Logic.CurrentLogic.Conditions)
                 {
 
                     if (Locationifon["Type"] == "7")
                     {
-                        if (Locationifon["AtHome"] == "0")
+                        guid = Locationifon["WhoSiteUId"];
+                        if (Locationifon["AtHome"] == "1")
                         {
-                            strname = btnleavehome.Text;
-                            leavehomeSelected.Visible = true;
-                            athomeSelected.Visible = false;
-                            btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                            btnathome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                            strname = Language.StringByID(MyInternationalizationString.athome);
                         }
                         else
                         {
-                            strname = btnathome.Text;
-                            leavehomeSelected.Visible = false;
-                            athomeSelected.Visible = true;
-                            btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                            btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                            //绂诲紑鍦扮偣
+                            strname = Language.StringByID(MyInternationalizationString.leavehome);
                         }
                         break;
                     }
                 }
+
+                foreach (var accounts in Common.Logic.CurrentLogic.Accounts)
+                {
+
+                    if (accounts["Type"] == "7" && accounts["Account"] == guid)
+                    {
+
+                        ///杞崲涓篸ouble绫诲瀷锛�
+                        latitude = Convert.ToDouble(accounts["Latitude"]) / 1000000.0;
+                        longitude = Convert.ToDouble(accounts["Longitude"]) / 1000000.0;
+                        r = int.Parse(accounts["Radius"]);
+                        break;
+                    }
+                }
             }
+            PublicInterface publicInterface = new PublicInterface();
+            var list = publicInterface.GetViewList("鍦扮悊鍥存爮");
+            publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.location, strname, (str) =>
+             {
+                 var LocationConditionsInfo = new Dictionary<string, string>();
+                 LocationConditionsInfo.Add("Type", "7");
+                 LocationConditionsInfo.Add("IsValid", "1");
+                 LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid);
 
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
-            {
+                 if (str == Language.StringByID(MyInternationalizationString.athome))
+                 {
 
-                if (!leavehomeSelected.Visible && !athomeSelected.Visible)
-                {
-                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                if (LocationConditionsInfo.ContainsKey("Type"))
-                {
-                    LocationConditionsInfo.Remove("Type");
-                }
-                if (LocationConditionsInfo.ContainsKey("IsValid"))
-                {
-                    LocationConditionsInfo.Remove("IsValid");
-                }
-                LocationConditionsInfo.Add("Type", "7");
-                LocationConditionsInfo.Add("IsValid", "1");
-                if (leavehomeSelected.Visible)
-                {
-                    if (LocationConditionsInfo.ContainsKey("AtHome"))
-                    {
-                        LocationConditionsInfo.Remove("AtHome");
-                    }
-                    LocationConditionsInfo.Add("AtHome", "0");
-                }
-                else
-                {
-                    if (LocationConditionsInfo.ContainsKey("AtHome"))
-                    {
-                        LocationConditionsInfo.Remove("AtHome");
-                    }
-                    LocationConditionsInfo.Add("AtHome", "1");
-                }
-                double a1 = Config.Instance.Home.Latitude, a2 = Config.Instance.Home.Longitude;
-                //璋冪敤鏂规硶锛岃烦杞〉闈�
-                GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
-                {
+                     LocationConditionsInfo.Add("AtHome", "1");
+                 }
+                 else if (str == Language.StringByID(MyInternationalizationString.leavehome))
+                 {
 
-                    //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥�
-                    var latitud = (int)Math.Truncate(mLatitude * 1000000);
-                    var longitude = (int)Math.Truncate(mLongitude * 1000000);
+                     LocationConditionsInfo.Add("AtHome", "0");
+                 }
+
+#if Android
+             //鐢宠瀹氫綅鏉冮檺
+             ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
+             {
+                 if (result1 == false) { return; }
+
+                 //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠�
+                 ((BaseActivity)Application.Activity).SetPermission((result2) =>
+                 {
+                     if (result2 == false) { return; }
+                      //璇诲彇鐢佃瘽鐘舵�佹潈闄�
+                      ((BaseActivity)Application.Activity).SetPermission((result3) =>
+                      {
+                          if (result3 == false) { return; }
+
+                         //璋冪敤鏂规硶锛岃烦杞〉闈�
+                         GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+                          {
+                             //鎴彇瀛楃涓插悗绗�6浣嶏紱
+                             //var len = name.Substring(name.Length - 6, 6);
+
+                             //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥�
+                             var latitudW = (int)Math.Truncate(mLatitude * 1000000);
+                              var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
+                              Dictionary<string, string> accounts = new Dictionary<string, string>();
+                              accounts.Add("Account", Config.Instance.Guid);
+                              accounts.Add("Type", "7");
+                              accounts.Add("Latitude", latitudW.ToString());
+                              accounts.Add("Longitude", longitudeH.ToString());
+                              accounts.Add("Radius", mRadius.ToString());
+
+                              LogicIfon.Addaccounts(accounts);
+                              LogicIfon.AddLocationconditions(LocationConditionsInfo);
+
+                              var logicCommunalPage = new LogicCommunalPage();
+                              UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                              UserView.HomePage.Instance.PageIndex += 1;
+                              logicCommunalPage.Show(() => { });
+                          }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
+
+                      }, "android.permission.READ_PHONE_STATE");
+
+                 }, "android.permission.WRITE_EXTERNAL_STORAGE");
+             });
+#endif
+#if iOS
+                //璋冪敤鏂规硶锛岃烦杞〉闈�
+                GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+                {
+                    //鎴彇瀛楃涓插悗绗�6浣嶏紱
+                    //var len = name.Substring(name.Length - 6, 6);
+
+                    //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥�
+                    var latitudW = (int)Math.Truncate(mLatitude * 1000000);
+                    var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
                     Dictionary<string, string> accounts = new Dictionary<string, string>();
-                    if (accounts.ContainsKey("Account"))
-                    {
-                        accounts.Remove("Account");
-                    }
-                    if (accounts.ContainsKey("Type"))
-                    {
-                        accounts.Remove("Type");
-                    }
-                    if (accounts.ContainsKey("Latitude"))
-                    {
-                        accounts.Remove("latitude");
-                    }
-                    if (accounts.ContainsKey("Longitude"))
-                    {
-                        accounts.Remove("Longitude");
-                    }
-                    if (accounts.ContainsKey("Radius"))
-                    {
-                        accounts.Remove("radius");
-                    }
                     accounts.Add("Account", Config.Instance.Guid);
                     accounts.Add("Type", "7");
-                    accounts.Add("Latitude", latitud.ToString());
-                    accounts.Add("Longitude", longitude.ToString());
+                    accounts.Add("Latitude", latitudW.ToString());
+                    accounts.Add("Longitude", longitudeH.ToString());
                     accounts.Add("Radius", mRadius.ToString());
+
                     LogicIfon.Addaccounts(accounts);
                     LogicIfon.AddLocationconditions(LocationConditionsInfo);
+
                     var logicCommunalPage = new LogicCommunalPage();
                     UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                     UserView.HomePage.Instance.PageIndex += 1;
                     logicCommunalPage.Show(() => { });
-                }, strname, true, a1, a2, 500);
-            };
+                }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
+#endif
+            });
+
+       
         }
 
         /// <summary>
@@ -991,188 +327,11 @@
         /// </summary>
         void TimeView()
         {
-            UserView.HomePage.Instance.ScrollEnabled = false;
-            Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
-            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
-            this.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender12, e12) =>
+            PublicInterface publicInterface = new PublicInterface();
+            var list = publicInterface.GetViewList("鏃堕棿");
+            publicInterface.SingleSelectionShow(this, list, MyInternationalizationString.type, "", (str) =>
             {
-                flMain.RemoveFromParent();
-            };
-
-           
-
-            var timetypeframelayout = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(530),
-                Y = Application.GetRealHeight(1920 - 530),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-               // Radius = (uint)Application.GetRealHeight(60),
-            };
-            flMain.AddChidren(timetypeframelayout);
-            timetypeframelayout.SetCornerWithSameRadius(20,HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight);
-
-            #region  -------鍙栨秷   瀹屾垚
-            var timetype = new RowLayout
-            {
-                Height = Application.GetRealHeight(140),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            timetypeframelayout.AddChidren(timetype);
-            var Btncancel = new Button
-            {
-                TextID = MyInternationalizationString.cancel,
-                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                X = Application.GetRealWidth(80),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 14,
-            };
-            timetype.AddChidren(Btncancel);
-            Btncancel.MouseUpEventHandler += (sender16, e16) =>
-            {
-                flMain.RemoveFromParent();
-                UserView.HomePage.Instance.ScrollEnabled = true;
-            };
-
-            var Btntitle = new Button
-            {
-                TextID = MyInternationalizationString.type,
-                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(320),
-                TextAlignment = TextAlignment.Center,
-                X = Btncancel.Right + Application.GetRealWidth(100),
-                TextSize = 16,
-            };
-            timetype.AddChidren(Btntitle);
-            var Btncomplete = new Button
-            {
-                TextID = MyInternationalizationString.complete,
-                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
-                Height = Application.GetRealHeight(140),
-                Width = Application.GetRealWidth(200),
-                TextAlignment = TextAlignment.CenterRight,
-                X = Btntitle.Right + Application.GetRealWidth(100),
-                TextSize = 14,
-
-            };
-            timetype.AddChidren(Btncomplete);
-            #endregion
-
-            #region  -------绔嬪嵆鎵ц   鏃堕棿鑼冨洿
-
-            #region  -------绔嬪嵆鎵ц 
-            var timepointFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timetype.Bottom + Application.GetRealHeight(20),
-            };
-            timetypeframelayout.AddChidren(timepointFrameLayout);
-
-            var timerow = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-            };
-            timepointFrameLayout.AddChidren(timerow);
-
-
-            var Btntimepoint = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.immediateexecution,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                //Text="绔嬪嵆鎵ц",
-                TextSize = 14,
-            };
-            timerow.AddChidren(Btntimepoint);
-
-            var timepointSelected = new SelectedButton();
-            timerow.AddChidren(timepointSelected);
-            #endregion
-
-
-            #region  -------鏃堕棿鑼冨洿
-            var timeFrameLayout = new FrameLayout
-            {
-                Height = Application.GetRealHeight(160),
-                Y = timepointFrameLayout.Bottom,
-            };
-            timetypeframelayout.AddChidren(timeFrameLayout);
-
-            var time1row = new RowLayout
-            {
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(920),
-                Height = Application.GetRealHeight(130),
-                X = Application.GetRealWidth(80),
-                LineColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            timeFrameLayout.AddChidren(time1row);
-
-            var Btntime = new Button
-            {
-                Width = Application.GetRealWidth(600),
-                TextID = MyInternationalizationString.timeframe,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                //Text = "鏃堕棿鑼冨洿",
-                TextSize = 14,
-            };
-            time1row.AddChidren(Btntime);
-
-            var timeSelected = new SelectedButton();
-            time1row.AddChidren(timeSelected);
-            #endregion
-
-
-            ///绔嬪嵆鎵ц鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> timepointclick = (sedner14, e14) =>
-            {
-                Btntimepoint.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                Btntime.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                timepointSelected.Visible = true;
-                timeSelected.Visible = false;
-            };
-            timepointFrameLayout.MouseUpEventHandler += timepointclick;
-            timerow.MouseUpEventHandler += timepointclick;
-            Btntimepoint.MouseUpEventHandler += timepointclick;
-            timepointSelected.MouseUpEventHandler += timepointclick;
-
-
-            ///鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢
-            EventHandler<MouseEventArgs> timeclick = (sedner15, e15) =>
-            {
-                Btntimepoint.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                Btntime.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                timepointSelected.Visible = false;
-                timeSelected.Visible = true;
-            };
-            Btntime.MouseUpEventHandler += timeclick;
-            time1row.MouseUpEventHandler += timeclick;
-            timeSelected.MouseUpEventHandler += timeclick;
-            timeFrameLayout.MouseUpEventHandler += timeclick;
-            #endregion
-
-
-
-            Btncomplete.MouseUpEventHandler += (sender, e) =>
-            {
-                if (!timepointSelected.Visible && !timeSelected.Visible)
-                {
-                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-                if (timepointSelected.Visible)
+                if (str == Language.StringByID(MyInternationalizationString.immediateexecution))
                 {
 
                     Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>();
@@ -1189,7 +348,7 @@
                     UserView.HomePage.Instance.PageIndex += 1;
                     timePoint.Show(timeConditionsInfo);
                 }
-                else
+                else if (str == Language.StringByID(MyInternationalizationString.timeframe))
                 {
                     var timePage = new TimePage();
                     UserView.HomePage.Instance.AddChidren(timePage);
@@ -1197,9 +356,17 @@
                     timePage.Show();
 
                 }
-            };
+
+            });
+
+
+
+
+
+
         }
 
+
     }
- 
+
 }

--
Gitblit v1.8.0