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

---
 ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs |  548 +++++++++++++-----------------------------------------
 1 files changed, 134 insertions(+), 414 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
index 34909fd..0992fcf 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -78,15 +78,12 @@
             };
             securityView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                this.AddChidren(flMain);
-                SecurityView(flMain, false);
+                SecurityView(this,false);
             };
             positionView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
             {
-                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                this.AddChidren(flMain);
-                LocationView(flMain, false);
+              
+                LocationView(this, false);
             };
         }
 
@@ -97,212 +94,90 @@
         /// <param name="edit">If set to <c>true</c> edit.</param>
         public static void SecurityView(FrameLayout flMain, bool edit)
         {
-            UserView.HomePage.Instance.ScrollEnabled = false;
-            Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
-            #region  ---鐣岄潰甯冨眬閮ㄥ垎---
-            CompleteView completeView = new CompleteView();
-            flMain.AddChidren(completeView.Show(4));
-            completeView.Btntitle.TextID = MyInternationalizationString.security;
-            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
-            {
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-            };
-            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
-            athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                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;
-            };
-            removeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                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;
-
-            };
-            withdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                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;
-            };
-            urgentwithdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                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;
-
-            };
-
+         
+            string stateText = "";
             if (edit)
             {
                 foreach (var securityifon in Common.Logic.CurrentLogic.Conditions)
                 {
-
                     if (securityifon["Type"] == "6")
                     {
-                        if (securityifon["EnOrWithdrawMode"] == "0")
+                        switch (securityifon["EnOrWithdrawMode"])
                         {
-                            if (securityifon["ModeId"] == "1")
-                            {
-                                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
-                            {
-                                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;
-                            }
-
-
+                            case "0":
+                                {
+                                    if (securityifon["ModeId"] == "1")
+                                    {
+                                        stateText = Language.StringByID(MyInternationalizationString.logicathomegarrison);
+                                    }
+                                    else
+                                    {
+                                        stateText = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
+                                    }
+                                }
+                                break;
+                            case "1":
+                                {
+                                    stateText = Language.StringByID(MyInternationalizationString.withdrawal);
+                                }
+                                break;
+                            case "2":
+                                {
+                                    stateText = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
+                                }
+                                break;
                         }
-                        else if (securityifon["EnOrWithdrawMode"] == "1")
-                        {
-                            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;
                     }
                 }
             }
-            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
+            PublicInterface publicInterface = new PublicInterface();
+             var list=publicInterface.GetViewList("瀹夐槻");
+            publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.security, stateText, (str) =>
             {
-                if (!athomeView.selectedIconBtn.Visible && !removeView.selectedIconBtn.Visible && !withdrawalView.selectedIconBtn.Visible && !urgentwithdrawalView.selectedIconBtn.Visible)
-                {
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                if (SecurityConditionsInfo.ContainsKey("Type"))
-                {
-                    SecurityConditionsInfo.Remove("Type");
-                }
-                if (SecurityConditionsInfo.ContainsKey("IsValid"))
-                {
-                    SecurityConditionsInfo.Remove("IsValid");
-                }
-                if (SecurityConditionsInfo.ContainsKey("ModeId"))
-                {
-                    SecurityConditionsInfo.Remove("ModeId");
-                }
-                SecurityConditionsInfo.Add("Type", "6");
-                SecurityConditionsInfo.Add("IsValid", "1");
-                if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
-                {
-                    SecurityConditionsInfo.Remove("EnOrWithdrawMode");
-                }
-                if (SecurityConditionsInfo.ContainsKey("ModeId"))
-                {
-                    SecurityConditionsInfo.Remove("ModeId");
-                }
+                string EnOrWithdrawMode = "";
+                string ModeId = "";
                 //鍦ㄥ甯冮槻
-                if (athomeView.selectedIconBtn.Visible)
+                if (str == Language.StringByID(MyInternationalizationString.logicathomegarrison))
                 {
+                    EnOrWithdrawMode = "0";
+                    ModeId = "1";
 
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
-                    SecurityConditionsInfo.Add("ModeId", "1");
                 }
                 //绂诲甯冮槻
-                if (removeView.selectedIconBtn.Visible)
+                else if (str == Language.StringByID(MyInternationalizationString.logicremovehomegarrison))
                 {
+                    EnOrWithdrawMode = "0";
+                    ModeId = "2";
 
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
-                    SecurityConditionsInfo.Add("ModeId", "2");
                 }
                 //鎾ら槻
-                if (withdrawalView.selectedIconBtn.Visible)
+                else if (str == Language.StringByID(MyInternationalizationString.withdrawal))
                 {
+                    EnOrWithdrawMode = "1";
+                    ModeId = "0";
 
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "1");
-                    SecurityConditionsInfo.Add("ModeId", "0");
                 }
                 //鑳佽揩鎾ら槻
-                if (urgentwithdrawalView.selectedIconBtn.Visible)
+                else if (str == Language.StringByID(MyInternationalizationString.urgentwithdrawal))
                 {
+                    EnOrWithdrawMode = "2";
+                    ModeId = "0";
 
-                    SecurityConditionsInfo.Add("EnOrWithdrawMode", "2");
-                    SecurityConditionsInfo.Add("ModeId", "0");
                 }
-                LogicIfon.AddSecurityconditions(SecurityConditionsInfo);
+
+                var securityConditions = new Dictionary<string, string>();  
+                securityConditions.Add("Type", "6");
+                securityConditions.Add("IsValid", "1");
+                securityConditions.Add("EnOrWithdrawMode", EnOrWithdrawMode); 
+                securityConditions.Add("ModeId", ModeId);
+
+                LogicIfon.AddSecurityconditions(securityConditions);
                 var logicCommunalPage = new LogicCommunalPage();
                 UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                 UserView.HomePage.Instance.PageIndex += 1;
                 logicCommunalPage.Show(() => { });
-            };
 
+            });
         }
         /// <summary>
         /// 鍦扮悊鍥存爮View
@@ -311,52 +186,7 @@
         /// <param name="edit">If set to <c>true</c> edit.</param>
         public static void LocationView(FrameLayout flMain, bool edit)
         {
-            UserView.HomePage.Instance.ScrollEnabled = false;
-            Dictionary<string, string> LocationConditionsInfo = new Dictionary<string, string>();
-            #region  ------鐣岄潰甯冨眬閮ㄥ垎   
-            CompleteView completeView = new CompleteView();
-            flMain.AddChidren(completeView.Show(2));
-            completeView.Btntitle.TextID = MyInternationalizationString.location;
-            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
-            {
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-            };
-            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 = "";
-            //鍒拌揪鍦扮偣鐐瑰嚮浜嬩欢
-            athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-
-                strname = athomeView.titleBtn.Text;
-                leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                leaveView.selectedIconBtn.Visible = false;
-                athomeView.selectedIconBtn.Visible = true;
-            };
-            //绂诲紑鍦扮偣鐐瑰嚮浜嬩欢
-            leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                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;//鍗婂緞
@@ -371,19 +201,12 @@
                         guid = Locationifon["WhoSiteUId"];
                         if (Locationifon["AtHome"] == "1")
                         {
-                            strname = athomeView.titleBtn.Text;
-                            leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                            leaveView.selectedIconBtn.Visible = false;
-                            athomeView.selectedIconBtn.Visible = true;
+                            strname = Language.StringByID(MyInternationalizationString.athome);
                         }
                         else
                         {
-                            strname = leaveView.titleBtn.Text;
-                            leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                            athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                            leaveView.selectedIconBtn.Visible = true;
-                            athomeView.selectedIconBtn.Visible = false;
+                            //绂诲紑鍦扮偣
+                            strname = Language.StringByID(MyInternationalizationString.leavehome);
                         }
                         break;
                     }
@@ -403,112 +226,70 @@
                     }
                 }
             }
+            PublicInterface publicInterface = new PublicInterface();
+            var list = publicInterface.GetViewList("鍦扮悊鍥存爮");
+            publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.location, strname, (str) =>
+             {
+                 var LocationConditionsInfo = new Dictionary<string, string>();
+                 LocationConditionsInfo.Add("Type", "7");
+                 LocationConditionsInfo.Add("IsValid", "1");
+                 LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid);
 
-            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
-            {
+                 if (str == Language.StringByID(MyInternationalizationString.athome))
+                 {
 
-                if (!leaveView.selectedIconBtn.Visible && !athomeView.selectedIconBtn.Visible)
-                {
-                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                if (LocationConditionsInfo.ContainsKey("Type"))
-                {
-                    LocationConditionsInfo.Remove("Type");
-                }
-                if (LocationConditionsInfo.ContainsKey("IsValid"))
-                {
-                    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 (leaveView.selectedIconBtn.Visible)
-                {
-                    if (LocationConditionsInfo.ContainsKey("AtHome"))
-                    {
-                        LocationConditionsInfo.Remove("AtHome");
-                    }
-                    LocationConditionsInfo.Add("AtHome", "0");
-                }
-                else
-                {
-                    if (LocationConditionsInfo.ContainsKey("AtHome"))
-                    {
-                        LocationConditionsInfo.Remove("AtHome");
-                    }
-                    LocationConditionsInfo.Add("AtHome", "1");
-                }
-
+                     LocationConditionsInfo.Add("AtHome", "1");
+                 }
+                 else if (str == Language.StringByID(MyInternationalizationString.leavehome))
+                 {
+
+                     LocationConditionsInfo.Add("AtHome", "0");
+                 }
+
 #if Android
-            //鐢宠瀹氫綅鏉冮檺
-            ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
-            {
-                if (result1 == false) { return; }
-
-                //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠�
-                ((BaseActivity)Application.Activity).SetPermission((result2) =>
-                {
-                    if (result2 == false) { return; }
-                     //璇诲彇鐢佃瘽鐘舵�佹潈闄�
-                     ((BaseActivity)Application.Activity).SetPermission((result3) =>
-                     {
-                         if (result3 == false) { return; }
-
-                         //璋冪敤鏂规硶锛岃烦杞〉闈�
-                         GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
-                         {
-                             //鎴彇瀛楃涓插悗绗�6浣嶏紱
-                             //var len = name.Substring(name.Length - 6, 6);
-
-                             //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥�
-                             var latitudW = (int)Math.Truncate(mLatitude * 1000000);
-                             var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
-                             Dictionary<string, string> accounts = new Dictionary<string, string>();
-                             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");
-            });
+             //鐢宠瀹氫綅鏉冮檺
+             ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
+             {
+                 if (result1 == false) { return; }
+
+                 //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠�
+                 ((BaseActivity)Application.Activity).SetPermission((result2) =>
+                 {
+                     if (result2 == false) { return; }
+                      //璇诲彇鐢佃瘽鐘舵�佹潈闄�
+                      ((BaseActivity)Application.Activity).SetPermission((result3) =>
+                      {
+                          if (result3 == false) { return; }
+
+                         //璋冪敤鏂规硶锛岃烦杞〉闈�
+                         GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+                          {
+                             //鎴彇瀛楃涓插悗绗�6浣嶏紱
+                             //var len = name.Substring(name.Length - 6, 6);
+
+                             //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥�
+                             var latitudW = (int)Math.Truncate(mLatitude * 1000000);
+                              var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
+                              Dictionary<string, string> accounts = new Dictionary<string, string>();
+                              accounts.Add("Account", Config.Instance.Guid);
+                              accounts.Add("Type", "7");
+                              accounts.Add("Latitude", latitudW.ToString());
+                              accounts.Add("Longitude", longitudeH.ToString());
+                              accounts.Add("Radius", mRadius.ToString());
+
+                              LogicIfon.Addaccounts(accounts);
+                              LogicIfon.AddLocationconditions(LocationConditionsInfo);
+
+                              var logicCommunalPage = new LogicCommunalPage();
+                              UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+                              UserView.HomePage.Instance.PageIndex += 1;
+                              logicCommunalPage.Show(() => { });
+                          }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
+
+                      }, "android.permission.READ_PHONE_STATE");
+
+                 }, "android.permission.WRITE_EXTERNAL_STORAGE");
+             });
 #endif
 #if iOS
                 //璋冪敤鏂规硶锛岃烦杞〉闈�
@@ -521,26 +302,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());
@@ -556,7 +317,9 @@
                     logicCommunalPage.Show(() => { });
                 }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
 #endif
-            };
+            });
+
+       
         }
 
         /// <summary>
@@ -564,61 +327,11 @@
         /// </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);
-            CompleteView completeView = new CompleteView();
-            flMain.AddChidren(completeView.Show(2));
-            completeView.Btntitle.TextID = MyInternationalizationString.type;
-            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
+            PublicInterface publicInterface = new PublicInterface();
+            var list = publicInterface.GetViewList("鏃堕棿");
+            publicInterface.SingleSelectionShow(this, list, MyInternationalizationString.type, "", (str) =>
             {
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-            };
-            flMain.MouseUpEventHandler += clickcancel;
-            completeView.Btncancel.MouseUpEventHandler += clickcancel;
-
-            //绔嬪嵆鎵ц
-            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) => {
-
-                timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
-                timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                timeView.selectedIconBtn.Visible = false;
-                timepointView.selectedIconBtn.Visible = true;
-            };
-            //鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢
-            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;
-            };
-
-            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
-            {
-                if (!timepointView.selectedIconBtn.Visible && !timeView.selectedIconBtn.Visible)
-                {
-                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
-                    return;
-                }
-                UserView.HomePage.Instance.ScrollEnabled = true;
-                flMain.RemoveFromParent();
-                if (timepointView.selectedIconBtn.Visible)
+                if (str == Language.StringByID(MyInternationalizationString.immediateexecution))
                 {
 
                     Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>();
@@ -635,7 +348,7 @@
                     UserView.HomePage.Instance.PageIndex += 1;
                     timePoint.Show(timeConditionsInfo);
                 }
-                else
+                else if (str == Language.StringByID(MyInternationalizationString.timeframe))
                 {
                     var timePage = new TimePage();
                     UserView.HomePage.Instance.AddChidren(timePage);
@@ -643,7 +356,14 @@
                     timePage.Show();
 
                 }
-            };
+
+            });
+
+
+
+
+
+
         }
 
 

--
Gitblit v1.8.0