黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -5,366 +5,91 @@
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 ()
        public AddLogicPage()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            #region  最上面的布局代码
            var topRowLayout = new RowLayout
            #region  界面的布局代码
            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 = 16,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(400),
                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  最下面的布局代码
            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);
            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,
            };
            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,
            };
            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) =>
            {
                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);
                var roomAndDeviceView = new RoomAndDeviceView();
                UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
                UserView.HomePage.Instance.PageIndex += 1;
                deviceStateCondition.Show();
                roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic;
                roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate));
            };
            deviceframelayout.MouseUpEventHandler += devicestateclick;
            btndevice.MouseUpEventHandler += devicestateclick;
            btndeviceback.MouseUpEventHandler += devicestateclick;
            deviceiconBtn.MouseUpEventHandler += devicestateclick;
            devicerow.MouseUpEventHandler += devicestateclick;
            #endregion
            #region   ----安防条件----
            var securityframelayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                Y = deviceframelayout.Bottom,
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            };
            middle.AddChidren(securityframelayout);
            var securityiconBtn = new Button
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                UnSelectedImagePath = "ZigeeLogic/security.png",
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(55),
            };
            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,
            };
            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) =>
            securityView.clickviewBtn.MouseUpEventHandler += (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,
            };
            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) =>
            positionView.clickviewBtn.MouseUpEventHandler += (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,
            };
            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,223 +99,85 @@
        {
            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) =>
            #region  ---界面布局部分---
            CompleteView completeView = new CompleteView();
            flMain.AddChidren(completeView.Show(4));
            completeView.Btntitle.TextID = MyInternationalizationString.security;
            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
            {
                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),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                Radius = (uint)Application.GetRealHeight(60),
            };
            flMain.AddChidren(securityfra);
            #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,
            };
            timetype.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
            {
                flMain.RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
                flMain.RemoveFromParent();
            };
            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),
            };
            timetype.AddChidren(Btncomplete);
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
            //在家布防
            mFunView athomeView = new mFunView();
            athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20);
            completeView.Show(4).AddChidren(athomeView.Show());
            athomeView.titleBtn.TextID = MyInternationalizationString.logicathomegarrison;
            //离家布防
            mFunView removeView = new mFunView();
            removeView.frameLayout.Y = athomeView.frameLayout.Bottom;
            completeView.Show(4).AddChidren(removeView.Show());
            removeView.titleBtn.TextID = MyInternationalizationString.logicremovehomegarrison;
            //撤防
            mFunView withdrawalView = new mFunView();
            withdrawalView.frameLayout.Y = removeView.frameLayout.Bottom;
            completeView.Show(4).AddChidren(withdrawalView.Show());
            withdrawalView.titleBtn.TextID = MyInternationalizationString.withdrawal;
            //胁迫撤防
            mFunView urgentwithdrawalView = new mFunView();
            urgentwithdrawalView.frameLayout.Y = withdrawalView.frameLayout.Bottom;
            completeView.Show(4).AddChidren(urgentwithdrawalView.Show());
            urgentwithdrawalView.titleBtn.TextID = MyInternationalizationString.urgentwithdrawal;
            urgentwithdrawalView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
            #endregion
            #region  ----在家布防 离家布防  撤防
            #region  在家布防
            var athomeFrameLayout = new FrameLayout
            athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Height = Application.GetRealHeight(160),
                Y = timetype.Bottom + Application.GetRealHeight(20),
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomeView.selectedIconBtn.Visible = true;
                removeView.selectedIconBtn.Visible = false;
                withdrawalView.selectedIconBtn.Visible = false;
                urgentwithdrawalView.selectedIconBtn.Visible = false;
            };
            securityfra.AddChidren(athomeFrameLayout);
            var athomedefenceRowLayout = new RowLayout
            removeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(920),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(80),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            athomeFrameLayout.AddChidren(athomedefenceRowLayout);
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomeView.selectedIconBtn.Visible = false;
                removeView.selectedIconBtn.Visible = true;
                withdrawalView.selectedIconBtn.Visible = false;
                urgentwithdrawalView.selectedIconBtn.Visible = false;
            var btnathomedefence = new Button
            };
            withdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Width = Application.GetRealWidth(600),
                TextID = MyInternationalizationString.logicathomegarrison,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomeView.selectedIconBtn.Visible = false;
                removeView.selectedIconBtn.Visible = false;
                withdrawalView.selectedIconBtn.Visible = true;
                urgentwithdrawalView.selectedIconBtn.Visible = false;
            };
            athomedefenceRowLayout.AddChidren(btnathomedefence);
            var athomedefenceSelected = new SelectedButton();
            athomedefenceRowLayout.AddChidren(athomedefenceSelected);
            #endregion
            #region  离家布防
            var leavehomeFrameLayout = new FrameLayout
            urgentwithdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Height = Application.GetRealHeight(160),
                Y = athomeFrameLayout.Bottom,
            };
            securityfra.AddChidren(leavehomeFrameLayout);
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                athomeView.selectedIconBtn.Visible = false;
                removeView.selectedIconBtn.Visible = false;
                withdrawalView.selectedIconBtn.Visible = false;
                urgentwithdrawalView.selectedIconBtn.Visible = true;
            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,
            };
            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,
            };
            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
            if (edit)
            {
@@ -603,41 +190,58 @@
                        {
                            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;
                                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                athomeView.selectedIconBtn.Visible = true;
                                removeView.selectedIconBtn.Visible = false;
                                withdrawalView.selectedIconBtn.Visible = false;
                                urgentwithdrawalView.selectedIconBtn.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;
                                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                athomeView.selectedIconBtn.Visible = false;
                                removeView.selectedIconBtn.Visible = true;
                                withdrawalView.selectedIconBtn.Visible = false;
                                urgentwithdrawalView.selectedIconBtn.Visible = false;
                            }
                        }
                        else
                        else if (securityifon["EnOrWithdrawMode"] == "1")
                        {
                            btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            athomedefenceSelected.Visible = false;
                            leavehomedefenceSelected.Visible = false;
                            withdrawalSelected.Visible = true;
                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            athomeView.selectedIconBtn.Visible = false;
                            removeView.selectedIconBtn.Visible = false;
                            withdrawalView.selectedIconBtn.Visible = true;
                            urgentwithdrawalView.selectedIconBtn.Visible = false;
                        }
                        else if (securityifon["EnOrWithdrawMode"] == "2")
                        {
                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            athomeView.selectedIconBtn.Visible = false;
                            removeView.selectedIconBtn.Visible = false;
                            withdrawalView.selectedIconBtn.Visible = false;
                            urgentwithdrawalView.selectedIconBtn.Visible = true;
                        }
                        break;
                    }
                }
            }
            Btncomplete.MouseUpEventHandler += (sender, e) =>
            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
            {
                if (!athomedefenceSelected.Visible && !leavehomedefenceSelected.Visible && !withdrawalSelected.Visible)
                if (!athomeView.selectedIconBtn.Visible && !removeView.selectedIconBtn.Visible && !withdrawalView.selectedIconBtn.Visible && !urgentwithdrawalView.selectedIconBtn.Visible)
                {
                    return;
                }
@@ -654,46 +258,43 @@
                {
                    SecurityConditionsInfo.Remove("ModeId");
                }
                SecurityConditionsInfo.Add("Type", "6");
                SecurityConditionsInfo.Add("IsValid", "1");
                SecurityConditionsInfo.Add("ModeId", "0");
                //在家布防
                if (athomedefenceSelected.Visible)
                if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                {
                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                    {
                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                    }
                    if (SecurityConditionsInfo.ContainsKey("ModeId"))
                    {
                        SecurityConditionsInfo.Remove("ModeId");
                    }
                    SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                }
                if (SecurityConditionsInfo.ContainsKey("ModeId"))
                {
                    SecurityConditionsInfo.Remove("ModeId");
                }
                //在家布防
                if (athomeView.selectedIconBtn.Visible)
                {
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
                    SecurityConditionsInfo.Add("ModeId", "1");
                }
                //离家布防
                if (leavehomedefenceSelected.Visible)
                if (removeView.selectedIconBtn.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 (withdrawalView.selectedIconBtn.Visible)
                {
                    if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
                    {
                        SecurityConditionsInfo.Remove("EnOrWithdrawMode");
                    }
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "1");
                    SecurityConditionsInfo.Add("ModeId", "0");
                }
                //胁迫撤防
                if (urgentwithdrawalView.selectedIconBtn.Visible)
                {
                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "2");
                    SecurityConditionsInfo.Add("ModeId", "0");
                }
                LogicIfon.AddSecurityconditions(SecurityConditionsInfo);
                var logicCommunalPage = new LogicCommunalPage();
@@ -701,7 +302,7 @@
                UserView.HomePage.Instance.PageIndex += 1;
                logicCommunalPage.Show(() => { });
            };
        }
        /// <summary>
        /// 地理围栏View
@@ -712,207 +313,101 @@
        {
            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) =>
            #region  ------界面布局部分
            CompleteView completeView = new CompleteView();
            flMain.AddChidren(completeView.Show(2));
            completeView.Btntitle.TextID = MyInternationalizationString.location;
            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
            {
                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),
            };
            flMain.AddChidren(Locationfra);
            #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,
            };
            typeRow.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
            {
                flMain.RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
                flMain.RemoveFromParent();
            };
            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),
            };
            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,
            };
            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,
            };
            leavehomeRowLayout.AddChidren(btnleavehome);
            var leavehomeSelected = new SelectedButton();
            leavehomeRowLayout.AddChidren(leavehomeSelected);
            #endregion
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
            //到达地点
            mFunView athomeView = new mFunView();
            athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20);
            completeView.Show(2).AddChidren(athomeView.Show());
            athomeView.titleBtn.TextID = MyInternationalizationString.athome;
            //离开地点
            mFunView leaveView = new mFunView();
            leaveView.frameLayout.Y = athomeView.frameLayout.Bottom;
            completeView.Show(2).AddChidren(leaveView.Show());
            leaveView.titleBtn.TextID = MyInternationalizationString.leavehome;
            leaveView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
            #endregion
            string strname = "";
            ///在家点击事件
            EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) =>
            //到达地点点击事件
            athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                strname = btnathome.Text;
                btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                leavehomeSelected.Visible = false;
                athomeSelected.Visible = true;
                strname = athomeView.titleBtn.Text;
                leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                leaveView.selectedIconBtn.Visible = false;
                athomeView.selectedIconBtn.Visible = true;
            };
            btnathome.MouseUpEventHandler += athomeclick;
            athomeSelected.MouseUpEventHandler += athomeclick;
            athomeRowLayout.MouseUpEventHandler += athomeclick;
            athomeFrameLayout.MouseUpEventHandler += athomeclick;
            ///离家点击事件
            EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) =>
            //离开地点点击事件
            leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                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;
                strname = leaveView.titleBtn.Text;
                leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                leaveView.selectedIconBtn.Visible = true;
                athomeView.selectedIconBtn.Visible = false;
            };
            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 = athomeView.titleBtn.Text;
                            leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            leaveView.selectedIconBtn.Visible = false;
                            athomeView.selectedIconBtn.Visible = true;
                        }
                        else
                        {
                            strname = btnathome.Text;
                            leavehomeSelected.Visible = false;
                            athomeSelected.Visible = true;
                            btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            strname = leaveView.titleBtn.Text;
                            leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            leaveView.selectedIconBtn.Visible = true;
                            athomeView.selectedIconBtn.Visible = false;
                        }
                        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;
                    }
                }
            }
            Btncomplete.MouseUpEventHandler += (sender, e) =>
            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
            {
                if (!leavehomeSelected.Visible && !athomeSelected.Visible)
                if (!leaveView.selectedIconBtn.Visible && !athomeView.selectedIconBtn.Visible)
                {
                    ///可以提示未选中状态;
                    return;
@@ -926,9 +421,14 @@
                {
                    LocationConditionsInfo.Remove("IsValid");
                }
                if (LocationConditionsInfo.ContainsKey("WhoSiteUId"))
                {
                    LocationConditionsInfo.Remove("WhoSiteUId");
                }
                LocationConditionsInfo.Add("Type", "7");
                LocationConditionsInfo.Add("IsValid", "1");
                if (leavehomeSelected.Visible)
                LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid);
                if (leaveView.selectedIconBtn.Visible)
                {
                    if (LocationConditionsInfo.ContainsKey("AtHome"))
                    {
@@ -943,15 +443,83 @@
                        LocationConditionsInfo.Remove("AtHome");
                    }
                    LocationConditionsInfo.Add("AtHome", "1");
                }
                double a1 = 23.134421, a2 = 113.267189;
                //调用方法,跳转页面
                GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
                {
                    //点击保存按钮,回调当前选择的纬度,经度,半径范围
                    var latitud = (int)Math.Truncate(mLatitude * 1000000);
                    var longitude = (int)Math.Truncate(mLongitude * 1000000);
                }
#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>();
                             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", 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"))
                    {
@@ -975,16 +543,19 @@
                    }
                    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
            };
        }
@@ -993,190 +564,61 @@
        /// </summary>
        void TimeView()
        {
            UserView.HomePage.Instance.ScrollEnabled = false;
            Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
            #region  ------界面布局部分
            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
            this.AddChidren(flMain);
            flMain.MouseUpEventHandler += (sender12, e12) =>
            CompleteView completeView = new CompleteView();
            flMain.AddChidren(completeView.Show(2));
            completeView.Btntitle.TextID = MyInternationalizationString.type;
            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
            {
                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
            {
                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);
            #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,
            };
            timetype.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
            {
                flMain.RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
                flMain.RemoveFromParent();
            };
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
            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),
            };
            timetype.AddChidren(Btncomplete);
            //立即执行
            mFunView timepointView = new mFunView();
            timepointView.frameLayout.Y = Application.GetRealHeight(140 + 20);
            completeView.Show(2).AddChidren(timepointView.Show());
            timepointView.titleBtn.TextID = MyInternationalizationString.immediateexecution;
            //时间范围
            mFunView timeView = new mFunView();
            timeView.frameLayout.Y = timepointView.frameLayout.Bottom;
            completeView.Show(2).AddChidren(timeView.Show());
            timeView.titleBtn.TextID = MyInternationalizationString.timeframe;
            timeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
            #endregion
            //立即执行点击事件
            timepointView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
            #region  -------立即执行   时间范围
            #region  -------立即执行
            var timepointFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                Y = timetype.Bottom+Application.GetRealHeight(20),
                timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                timeView.selectedIconBtn.Visible = false;
                timepointView.selectedIconBtn.Visible = true;
            };
            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,
            //时间范围点击事件
            timeView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
                timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                timeView.selectedIconBtn.Visible = true;
                timepointView.selectedIconBtn.Visible = false;
            };
            timepointFrameLayout.AddChidren(timerow);
            var Btntimepoint = new Button
            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
            {
                Width = Application.GetRealWidth(600),
                TextID = MyInternationalizationString.immediateexecution,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                //Text="立即执行",
            };
            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 = "时间范围",
            };
            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)
                if (!timepointView.selectedIconBtn.Visible && !timeView.selectedIconBtn.Visible)
                {
                    ///可以提示未选中状态;
                    return;
                }
                UserView.HomePage.Instance.ScrollEnabled = true;
                flMain.RemoveFromParent();
                if (timepointSelected.Visible)
                if (timepointView.selectedIconBtn.Visible)
                {
                    Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>();
@@ -1204,5 +646,7 @@
            };
        }
    }
}