gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -1,4 +1,4 @@
using System;
       using System;
using System.Collections.Generic;
using Shared;
using Shared.Common;
@@ -8,9 +8,10 @@
namespace Shared.Phone.Device.Logic
{
    public class AddLogicPage : FrameLayout
    {
        public AddLogicPage ()
        public AddLogicPage()
        {
            Tag = "Logic";
        }
@@ -22,27 +23,28 @@
            {
                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
                Height = Application.GetRealHeight(184),
                LineColor= ZigbeeColor.Current.LogicRowLayoutTopLineColor,
                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
            };
            this.AddChidren(topRowLayout);
            var titleName = new Button {
                TextSize = 16,
                TextSize = 17,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(400),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                TextID = MyInternationalizationString.selection,
                IsBold = true,
            };
            topRowLayout.AddChidren(titleName);
            var clickBtn = new Button
            {
                Width = Application.GetRealWidth(81 + 51),
                Height = Application.GetRealHeight(58+40),
                Y = Application.GetRealHeight(98-40),
                Height = Application.GetRealHeight(58 + 40),
                Y = Application.GetRealHeight(98 - 40),
            };
            topRowLayout.AddChidren(clickBtn);
            clickBtn.MouseDownEventHandler += (sender, e) =>
@@ -59,22 +61,22 @@
                //Gravity = Gravity.CenterVertical;
                UnSelectedImagePath = "ZigeeLogic/back.png",
            };
            topRowLayout.AddChidren (back);
            topRowLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) => {
                RemoveFromParent ();
                RemoveFromParent();
            };
            #endregion
            #region  最下面的布局代码
            var middle = new FrameLayout {
                Y=topRowLayout.Bottom,
                Height=Application.GetRealHeight(1920-184),
                Y = topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren (middle);
            this.AddChidren(middle);
            #region   ----时间条件----
            var timeframelayout= new FrameLayout
            var timeframelayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
@@ -99,16 +101,17 @@
                Width = Application.GetRealWidth(850),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(176),
                LineColor= ZigbeeColor.Current.LogicRowLayoutLineColor,
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            timeframelayout.AddChidren(timerow);
            ///时间条件
            var btntime = new Button {
                Text=Language.StringByID (MyInternationalizationString.timecondition),
                Text = Language.StringByID(MyInternationalizationString.timecondition),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize=15,
            };
            timerow.AddChidren (btntime);
            timerow.AddChidren(btntime);
            var btntimeback = new Button {
                Width = Application.GetRealWidth(58),
@@ -117,7 +120,7 @@
                X = Application.GetRealWidth(789),
                Gravity = Gravity.CenterVertical,
            };
            timerow.AddChidren (btntimeback);
            timerow.AddChidren(btntimeback);
            EventHandler<MouseEventArgs> timeclick = (sender, e) =>
            {
@@ -138,7 +141,7 @@
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                Y = timeframelayout.Bottom,
            };
            middle.AddChidren (deviceframelayout);
            middle.AddChidren(deviceframelayout);
            var deviceiconBtn = new Button
            {
@@ -161,15 +164,16 @@
            };
            deviceframelayout.AddChidren(devicerow);
            ///设备状态条件
            var btndevice = new Button {
                //Text = "设备状态条件",
                TextID = MyInternationalizationString.device,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            devicerow.AddChidren (btndevice);
            devicerow.AddChidren(btndevice);
            var btndeviceback = new Button {
                Width = Application.GetRealWidth(58),
@@ -179,15 +183,10 @@
                UnSelectedImagePath = "ZigeeLogic/next.png",
            };
            devicerow.AddChidren (btndeviceback);
            devicerow.AddChidren(btndeviceback);
            EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
            {
                Common.Logic.LogicDviceList.Clear();
                if (Common.Logic.LogicDviceList.Count == 0)
                {
                    Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
                }
                var deviceStateCondition = new DeviceStateCondition();
                UserView.HomePage.Instance.AddChidren(deviceStateCondition);
                UserView.HomePage.Instance.PageIndex += 1;
@@ -236,6 +235,7 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextID = MyInternationalizationString.security,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            securityrow.AddChidren(btnsecurity);
@@ -245,7 +245,7 @@
                Height = Application.GetRealHeight(58),
                UnSelectedImagePath = "ZigeeLogic/next.png",
                X = Application.GetRealWidth(789),
                Gravity=Gravity.CenterVertical,
                Gravity = Gravity.CenterVertical,
            };
            securityrow.AddChidren(btnsecurityback);
@@ -296,6 +296,7 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextID = MyInternationalizationString.location,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            locationrow.AddChidren(btnlocation);
@@ -324,8 +325,8 @@
            #region   ----已有自动化条件----
            var existencerowlayout = new RowLayout {
                Height = Application.GetRealHeight (180),
                Y= securityframelayout.Bottom,
                Height = Application.GetRealHeight(180),
                Y = securityframelayout.Bottom,
            };
            //middle.AddChidren (existencerowlayout);
            ///已有自动化条件
@@ -336,35 +337,37 @@
                X = Application.GetRealWidth(60),
                TextID = MyInternationalizationString.automation,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            existencerowlayout.AddChidren (btnexistence);
            existencerowlayout.AddChidren(btnexistence);
            var btnexistenceback = new Button {
                Width = Application.GetRealWidth (110),
                Height = Application.GetRealHeight (110),
                Width = Application.GetRealWidth(110),
                Height = Application.GetRealHeight(110),
                UnSelectedImagePath = "ZigeeLogic/next.png",
                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
                X = Application.GetRealWidth (1080 - 140),
                Gravity=Gravity.CenterVertical,
                X = Application.GetRealWidth(1080 - 140),
                Gravity = Gravity.CenterVertical,
            };
            existencerowlayout.AddChidren (btnexistenceback);
            existencerowlayout.AddChidren(btnexistenceback);
            EventHandler<MouseEventArgs> logicclick = (sender, e) => {
                var logicListAutomation = new LogicListAutomation ();
                UserView.HomePage.Instance.AddChidren (logicListAutomation);
                var logicListAutomation = new LogicListAutomation();
                UserView.HomePage.Instance.AddChidren(logicListAutomation);
                UserView.HomePage.Instance.PageIndex += 1;
                logicListAutomation.Show ();
                logicListAutomation.Show();
            };
            btnexistenceback.MouseUpEventHandler += logicclick;
            btnexistence.MouseUpEventHandler += logicclick;
            existencerowlayout.MouseUpEventHandler += logicclick;
            #endregion
            #endregion
        }
        /// <summary>
        /// 安防条件View
        /// </summary>
@@ -381,23 +384,17 @@
                flMain.RemoveFromParent();
            };
            var securityfra1= new FrameLayout
            {
                Width = Application.GetRealWidth(1080),
                Height = Application.GetRealHeight(100),
                Y = Application.GetRealHeight(1920 - 100),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
            };
            flMain.AddChidren(securityfra1);
            var securityfra = new FrameLayout
            {
                Width = Application.GetRealWidth(1080),
                Height = Application.GetRealHeight(690),
                Y = Application.GetRealHeight(1920-690),
                Height = Application.GetRealHeight(690+160),
                Y = Application.GetRealHeight(1920 - 690-160),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                Radius = (uint)Application.GetRealHeight(60),
                //Radius = (uint)Application.GetRealHeight(60),
            };
            flMain.AddChidren(securityfra);
            securityfra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            #region  -------取消   完成
            var timetype = new RowLayout
            {
@@ -413,6 +410,7 @@
                Width = Application.GetRealWidth(200),
                X = Application.GetRealWidth(80),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
            };
            timetype.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
@@ -440,13 +438,14 @@
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.CenterRight,
                X = Btntitle.Right + Application.GetRealWidth(100),
                TextSize = 14,
            };
            timetype.AddChidren(Btncomplete);
            #endregion
            #region  ----在家布防 离家布防  撤防
            #region  ----在家布防 离家布防  撤防 胁迫撤防
            #region  在家布防
@@ -474,6 +473,7 @@
                TextID = MyInternationalizationString.logicathomegarrison,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
            athomedefenceRowLayout.AddChidren(btnathomedefence);
@@ -507,6 +507,7 @@
                TextID = MyInternationalizationString.logicremovehomegarrison,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
            leavehomedefenceRowLayout.AddChidren(leavehomebtndefence);
            var leavehomedefenceSelected = new SelectedButton();
@@ -527,7 +528,7 @@
                Width = Application.GetRealWidth(920),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(80),
                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            withdrawalFrameLayout.AddChidren(withdrawalRowLayout);
@@ -538,22 +539,56 @@
                TextID = MyInternationalizationString.withdrawal,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
            withdrawalRowLayout.AddChidren(btnwithdrawal);
            var withdrawalSelected = new SelectedButton();
            withdrawalRowLayout.AddChidren(withdrawalSelected);
            #endregion
            #region  胁迫撤防
            var urgentwithdFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                Y = withdrawalFrameLayout.Bottom,
            };
            securityfra.AddChidren(urgentwithdFrameLayout);
            #region  ----在家布防 离家布防  撤防点击事件
            var urgentwithdrawalRowLayout = new RowLayout
            {
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(920),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(80),
                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            };
            urgentwithdFrameLayout.AddChidren(urgentwithdrawalRowLayout);
            var btnurgentwithdrawal = new Button
            {
                TextID = MyInternationalizationString.urgentwithdrawal,
                Width = Application.GetRealWidth(600),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
            urgentwithdrawalRowLayout.AddChidren(btnurgentwithdrawal);
            var urgentwithdrawalSelected = new SelectedButton();
            urgentwithdrawalRowLayout.AddChidren(urgentwithdrawalSelected);
            #endregion
            #region  ----在家布防 离家布防  撤防 胁迫撤防点击事件
            ///在家布防点击事件
            EventHandler<MouseEventArgs> athomeclick = (sedner14, e14) =>
            {
                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnurgentwithdrawal.TextColor= ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomedefenceSelected.Visible = true;
                leavehomedefenceSelected.Visible = false;
                withdrawalSelected.Visible = false;
                urgentwithdrawalSelected.Visible = false;
            };
            athomedefenceRowLayout.MouseUpEventHandler += athomeclick;
            btnathomedefence.MouseUpEventHandler += athomeclick;
@@ -566,9 +601,11 @@
                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomedefenceSelected.Visible = false;
                leavehomedefenceSelected.Visible = true;
                withdrawalSelected.Visible = false;
                urgentwithdrawalSelected.Visible = false;
            };
            leavehomedefenceRowLayout.MouseUpEventHandler += leavehomeclick;
            leavehomebtndefence.MouseUpEventHandler += leavehomeclick;
@@ -580,14 +617,33 @@
                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomedefenceSelected.Visible = false;
                leavehomedefenceSelected.Visible = false;
                withdrawalSelected.Visible = true;
                urgentwithdrawalSelected.Visible = false;
            };
            withdrawalRowLayout.MouseUpEventHandler += disableclick;
            btnwithdrawal.MouseUpEventHandler += disableclick;
            withdrawalSelected.MouseUpEventHandler += disableclick;
            withdrawalFrameLayout.MouseUpEventHandler += disableclick;
            ///胁迫撤防点击事件
            EventHandler<MouseEventArgs> urgentwithdrawalclick = (seder, e) =>
            {
                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                athomedefenceSelected.Visible = false;
                leavehomedefenceSelected.Visible = false;
                withdrawalSelected.Visible = false;
                urgentwithdrawalSelected.Visible = true;
            };
            urgentwithdrawalRowLayout.MouseUpEventHandler += urgentwithdrawalclick;
            btnurgentwithdrawal.MouseUpEventHandler += urgentwithdrawalclick;
            urgentwithdrawalSelected.MouseUpEventHandler += urgentwithdrawalclick;
            urgentwithdFrameLayout.MouseUpEventHandler += urgentwithdrawalclick;
            #endregion
            #endregion
@@ -606,30 +662,47 @@
                                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                athomedefenceSelected.Visible = true;
                                leavehomedefenceSelected.Visible = false;
                                withdrawalSelected.Visible = false;
                                urgentwithdrawalSelected.Visible = false;
                            }
                            else
                            {
                                btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                athomedefenceSelected.Visible = false;
                                leavehomedefenceSelected.Visible = true;
                                withdrawalSelected.Visible = false;
                                urgentwithdrawalSelected.Visible = false;
                            }
                        }
                        else
                        else if (securityifon["EnOrWithdrawMode"] == "1")
                        {
                            btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            athomedefenceSelected.Visible = false;
                            leavehomedefenceSelected.Visible = false;
                            withdrawalSelected.Visible = true;
                            urgentwithdrawalSelected.Visible = false;
                        }
                        else if (securityifon["EnOrWithdrawMode"] == "2")
                        {
                            btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            athomedefenceSelected.Visible = false;
                            leavehomedefenceSelected.Visible = false;
                            withdrawalSelected.Visible = false;
                            urgentwithdrawalSelected.Visible = true;
                        }
                        break;
                    }
@@ -637,7 +710,7 @@
            }
            Btncomplete.MouseUpEventHandler += (sender, e) =>
            {
                if (!athomedefenceSelected.Visible && !leavehomedefenceSelected.Visible && !withdrawalSelected.Visible)
                if (!athomedefenceSelected.Visible && !leavehomedefenceSelected.Visible && !withdrawalSelected.Visible&&!urgentwithdrawalSelected.Visible)
                {
                    return;
                }
@@ -654,46 +727,43 @@
                {
                    SecurityConditionsInfo.Remove("ModeId");
                }
                SecurityConditionsInfo.Add("Type", "6");
                SecurityConditionsInfo.Add("IsValid", "1");
                SecurityConditionsInfo.Add("ModeId", "0");
                if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                {
                    SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                }
                if (SecurityConditionsInfo.ContainsKey("ModeId"))
                {
                    SecurityConditionsInfo.Remove("ModeId");
                }
                //在家布防
                if (athomedefenceSelected.Visible)
                {
                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                    {
                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                    }
                    if (SecurityConditionsInfo.ContainsKey("ModeId"))
                    {
                        SecurityConditionsInfo.Remove("ModeId");
                    }
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
                    SecurityConditionsInfo.Add("ModeId", "1");
                }
                //离家布防
                if (leavehomedefenceSelected.Visible)
                {
                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                    {
                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                    }
                    if (SecurityConditionsInfo.ContainsKey("ModeId"))
                    {
                        SecurityConditionsInfo.Remove("ModeId");
                    }
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
                    SecurityConditionsInfo.Add("ModeId", "2");
                }
                //撤防
                if (withdrawalSelected.Visible)
                {
                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                    {
                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                    }
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "1");
                    SecurityConditionsInfo.Add("ModeId", "0");
                }
                //胁迫撤防
                if (urgentwithdrawalSelected.Visible)
                {
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "2");
                    SecurityConditionsInfo.Add("ModeId", "0");
                }
                LogicIfon.AddSecurityconditions(SecurityConditionsInfo);
                var logicCommunalPage = new LogicCommunalPage();
@@ -701,7 +771,7 @@
                UserView.HomePage.Instance.PageIndex += 1;
                logicCommunalPage.Show(() => { });
            };
        }
        /// <summary>
        /// 地理围栏View
@@ -719,24 +789,17 @@
                flMain.RemoveFromParent();
            };
            var Locationfra1 = new FrameLayout
            {
                Width = Application.GetRealWidth(1080),
                Height = Application.GetRealHeight(100),
                Y = Application.GetRealHeight(1920 - 100),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
            };
            flMain.AddChidren(Locationfra1);
            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),
                //Radius = (uint)Application.GetRealHeight(60),
            };
            flMain.AddChidren(Locationfra);
            Locationfra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            #region  -------取消   完成
            var typeRow = new RowLayout
@@ -753,6 +816,7 @@
                Width = Application.GetRealWidth(200),
                X = Application.GetRealWidth(80),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
            };
            typeRow.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
@@ -780,13 +844,14 @@
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.CenterRight,
                X = Btntitle.Right + Application.GetRealWidth(100),
                TextSize = 14,
            };
            typeRow.AddChidren(Btncomplete);
            #endregion
            #region  ------在家   离家
            #region ------在家
            #region  ------到达地点   离开地点
            #region ------到达地点
            var athomeFrameLayout = new FrameLayout
            {
@@ -811,6 +876,7 @@
                TextID = MyInternationalizationString.athome,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
@@ -819,7 +885,7 @@
            athomeRowLayout.AddChidren(athomeSelected);
            #endregion
            #region -------离家
            #region -------离开地点
            var leavehomeFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
@@ -843,6 +909,7 @@
                TextID = MyInternationalizationString.leavehome,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                TextSize = 14,
            };
            leavehomeRowLayout.AddChidren(btnleavehome);
            var leavehomeSelected = new SelectedButton();
@@ -851,7 +918,7 @@
            #endregion
            string strname = "";
            ///在家点击事件
            ///到达地点点击事件
            EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) =>
            {
                strname = btnathome.Text;
@@ -867,7 +934,7 @@
            athomeRowLayout.MouseUpEventHandler += athomeclick;
            athomeFrameLayout.MouseUpEventHandler += athomeclick;
            ///离家点击事件
            ///离开地点点击事件
            EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) =>
            {
                strname = btnleavehome.Text;
@@ -880,14 +947,18 @@
            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")
                    {
                        guid = Locationifon["WhoSiteUId"];
                        if (Locationifon["AtHome"] == "0")
                        {
                            strname = btnleavehome.Text;
@@ -904,6 +975,20 @@
                            btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                        }
                        break;
                    }
                }
                foreach (var accounts in Common.Logic.CurrentLogic.Accounts)
                {
                    if (accounts["Type"] == "7" && accounts["Account"] == guid)
                    {
                        ///转换为double类型;
                        latitude = Convert.ToDouble(accounts["Latitude"])/1000000.0;
                        longitude = Convert.ToDouble(accounts["Longitude"]) / 1000000.0;
                        r = int.Parse(accounts["Radius"]);
                        break;
                    }
                }
@@ -926,8 +1011,13 @@
                {
                    LocationConditionsInfo.Remove("IsValid");
                }
                if (LocationConditionsInfo.ContainsKey("WhoSiteUId"))
                {
                    LocationConditionsInfo.Remove("WhoSiteUId");
                }
                LocationConditionsInfo.Add("Type", "7");
                LocationConditionsInfo.Add("IsValid", "1");
                LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid);
                if (leavehomeSelected.Visible)
                {
                    if (LocationConditionsInfo.ContainsKey("AtHome"))
@@ -944,14 +1034,16 @@
                    }
                    LocationConditionsInfo.Add("AtHome", "1");
                }
                double a1 = 23.134421, a2 = 113.267189;
                //调用方法,跳转页面
                GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
                {
                    //截取字符串后第6位;
                    //var len = name.Substring(name.Length - 6, 6);
                    //点击保存按钮,回调当前选择的纬度,经度,半径范围
                    var latitud = (int)Math.Truncate(mLatitude * 1000000);
                    var longitude = (int)Math.Truncate(mLongitude * 1000000);
                    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"))
                    {
@@ -975,8 +1067,8 @@
                    }
                    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);
@@ -984,7 +1076,7 @@
                    UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                    UserView.HomePage.Instance.PageIndex += 1;
                    logicCommunalPage.Show(() => { });
                }, strname, true, a1, a2, 500);
                }, strname, true, latitude, longitude, r);
            };
        }
@@ -1002,14 +1094,7 @@
                flMain.RemoveFromParent();
            };
            var timetypeframelayout1 = new FrameLayout
            {
                Width = Application.GetRealWidth(1080),
                Height = Application.GetRealHeight(100),
                Y = Application.GetRealHeight(1920 - 100),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
            };
            flMain.AddChidren(timetypeframelayout1);
            var timetypeframelayout = new FrameLayout
            {
@@ -1017,9 +1102,10 @@
                Height = Application.GetRealHeight(530),
                Y = Application.GetRealHeight(1920 - 530),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                Radius = (uint)Application.GetRealHeight(60),
               // Radius = (uint)Application.GetRealHeight(60),
            };
            flMain.AddChidren(timetypeframelayout);
            timetypeframelayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight);
            #region  -------取消   完成
            var timetype = new RowLayout
@@ -1034,8 +1120,9 @@
                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                Height = Application.GetRealHeight(140),
                Width = Application.GetRealWidth(200),
                X=Application.GetRealWidth(80),
                TextAlignment=TextAlignment.CenterLeft,
                X = Application.GetRealWidth(80),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
            };
            timetype.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
@@ -1044,14 +1131,14 @@
                UserView.HomePage.Instance.ScrollEnabled = true;
            };
            var Btntitle= new Button
            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),
                X = Btncancel.Right + Application.GetRealWidth(100),
                TextSize = 16,
            };
            timetype.AddChidren(Btntitle);
@@ -1063,7 +1150,8 @@
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.CenterRight,
                X = Btntitle.Right + Application.GetRealWidth(100),
                TextSize = 14,
            };
            timetype.AddChidren(Btncomplete);
            #endregion
@@ -1074,7 +1162,7 @@
            var timepointFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                Y = timetype.Bottom+Application.GetRealHeight(20),
                Y = timetype.Bottom + Application.GetRealHeight(20),
            };
            timetypeframelayout.AddChidren(timepointFrameLayout);
@@ -1096,6 +1184,7 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                //Text="立即执行",
                TextSize = 14,
            };
            timerow.AddChidren(Btntimepoint);
@@ -1108,7 +1197,7 @@
            var timeFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                Y =timepointFrameLayout.Bottom,
                Y = timepointFrameLayout.Bottom,
            };
            timetypeframelayout.AddChidren(timeFrameLayout);
@@ -1129,6 +1218,7 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                //Text = "时间范围",
                TextSize = 14,
            };
            time1row.AddChidren(Btntime);
@@ -1136,7 +1226,7 @@
            time1row.AddChidren(timeSelected);
            #endregion
            ///立即执行点击事件
            EventHandler<MouseEventArgs> timepointclick = (sedner14, e14) =>
            {
@@ -1205,4 +1295,5 @@
        }
    }
}