陈嘉乐
2020-08-27 c7f2e3791f931d18c6ab3b1b215e57a1101e0389
2020-08-27-1

优化发送等待的方法,地理围栏的代码
11个文件已修改
224 ■■■■■ 已修改文件
ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Home.Ios/AppDelegate.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/Method.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/Shared/Phone/Device/Logic/Send.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -1,31 +1,28 @@
<Properties StartupConfiguration="{28EDE1FF-20EF-476B-8AF8-24A3EEB69F45}|Default">
  <MonoDevelop.Ide.ItemProperties.GateWay.Droid AndroidDesignerPreferredTheme="MyTheme1" AndroidDesignerPreferredDevice="Nexus 4" PreferredExecutionTarget="Android.5c86e4357d63" />
  <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/AddLogicPage.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/SkipView.cs">
    <Files>
      <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="1206" Column="57" />
      <File FileName="GateWay.Droid/Application.cs" Line="190" Column="53" />
      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="159" Column="46" />
      <File FileName="Shared/Common/CommonPage.cs" Line="40" Column="44" />
      <File FileName="Shared/Phone/Device/Logic/LogicDveiceStatus.cs" Line="1" Column="1" />
      <File FileName="Shared/Phone/Device/Logic/AddLogicPage.cs" Line="1" Column="1" />
      <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="1" Column="1" />
      <File FileName="Shared/Phone/Device/Logic/SkipView.cs" Line="462" Column="1" />
      <File FileName="Shared/Phone/ZigBee/Common/Application.cs" Line="302" Column="1" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="GateWay" expanded="True">
            <Node name="GateWay.Droid" expanded="True">
              <Node name="Properties" expanded="True" />
            </Node>
            <Node name="Shared" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="Phone" expanded="True">
                <Node name="Device" expanded="True">
                  <Node name="Logic" expanded="True">
                    <Node name="AddLogicPage.cs" selected="True" />
                    <Node name="DoorLockLogic" expanded="True" />
                    <Node name="SkipView.cs" selected="True" />
                  </Node>
                </Node>
                <Node name="UserView" expanded="True" />
                <Node name="ZigBee" expanded="True">
                  <Node name="Common" expanded="True" />
                </Node>
              </Node>
            </Node>
          </Node>
@@ -35,9 +32,11 @@
  </MonoDevelop.Ide.Workbench>
  <MonoDevelop.Ide.ItemProperties.Home.IOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.D4411691-F5B8-40F4-97C1-964F33115DBC" />
  <MonoDevelop.Ide.DebuggingService.PinnedWatches />
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhoneSimulator" />
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore />
    <BreakpointStore>
      <Breakpoint file="/Users/hdl/Desktop/wjc/HomeApp/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs" relfile="Shared/Phone/Device/Logic/SkipView.cs" line="462" column="1" />
    </BreakpointStore>
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
  <MultiItemStartupConfigurations />
</Properties>
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml
@@ -161,6 +161,6 @@
        <!--  </>值来自开发者平台取得的AppKey-->
        <!-- 极光推送结束 -->
        <!-- 设置高德地图key -->
        <meta-data android:name="com.amap.api.v2.apikey" android:value="1f753413955012c9594c5df69eaa0aff" />
        <meta-data android:name="com.amap.api.v2.apikey" android:value="f78f951092602db3962811e736758559" />
    </application>
</manifest>
ZigbeeApp/Home.Ios/AppDelegate.cs
@@ -96,7 +96,7 @@
                }
            }
            AppCenter.Start("0ca801a2-742b-42fb-ba10-7ba4391371aa", typeof(Analytics), typeof(Crashes));
            GDMapKit.setGDApiKey("866fae25f336bc8d9a79b1d19267fffb");//高德地图key
            GDMapKit.setGDApiKey("3889cdfa4ef10c0d43348ffa2c1017c8");//高德地图key
            return true;
        }
ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -479,14 +479,6 @@
                    accounts.Add("Longitude", longitudeH.ToString());
                    accounts.Add("Radius", mRadius.ToString());
                    if (Send.It_Exist == "0")
                    {
                        //如果没有开启GPS服务,打开服务并且保存状态在本地;
                        //没有打开GPS服务,地理条件用不了;
                        Application.StartGPSLocationService();
                        Send.SaveLocalFile("GPS_File", "1");
                    }
                    LogicIfon.Addaccounts(accounts);
                    LogicIfon.AddLocationconditions(LocationConditionsInfo);
ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs
@@ -108,17 +108,6 @@
                        }
                    }
                    //foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions)
                    //{
                    //    if (deviceinfo["Type"] == "1")
                    //    {
                    //        if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"])
                    //        {
                    //            devices = deviceinfo;
                    //            break;
                    //        }
                    //    }
                    //}
                }
                else
                {
@@ -131,17 +120,7 @@
                            TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
                        }
                    }
                    //foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions)
                    //{
                    //    if (deviceinfo["LinkType"].ToString() == "0")
                    //    {
                    //        if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
                    //        {
                    //            TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
                    //            break;
                    //        }
                    //    }
                    //}
                }
            }
            #endregion
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
old mode 100755 new mode 100644
@@ -129,24 +129,7 @@
        /// <param name="user">触发源列表</param>
        public void SelectedUserID(Send.MembershipIfon user)
        {
            //元素超出9个就用上下滑动控件;
            VerticalScrolViewLayout vV = null;
            int count = user.UserIdMode.Count;
            if (count > 9)
            {
                ///元素超出9个;
                count = 6;
                //元素超出9个就用上下滑动控件;
                vV = new VerticalScrolViewLayout
                {
                    Y = Application.GetRealHeight(140 + 20),
                    Height = Application.GetRealHeight(160 * count),
                };
                //清除之前的控件;
                vV.RemoveAll();
            }
            #region  -------取消   完成
            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
            this.AddChidren(flMain);
@@ -161,13 +144,28 @@
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
            #endregion
            //元素超出9个就用上下滑动控件;
            VerticalScrolViewLayout vV = null;
            if (count > 9)
            {
                ///元素超出9个;
                count = 6;
                //元素超出9个就用上下滑动控件;
                vV = new VerticalScrolViewLayout
                {
                    Y = Application.GetRealHeight(140 + 20),
                    Height = Application.GetRealHeight(160 * count),
                };
                //元素超出9个就用上下滑动控件;
                completeView.Show(count).AddChidren(vV);
                //清除之前的控件;
                vV.RemoveAll();
            }
            ///定两个变量记录之前的只值;
            string userId = "";
            string openMode = "";
            string accountName = "";
            string SelectedDeviceStatuscondition = "";
            for (int i = 0; i < user.UserIdMode.Count; i++)
            {
                var userifon = user.UserIdMode[i];
@@ -175,8 +173,7 @@
                mFunView lockView = new mFunView();
                if (user.UserIdMode.Count > 9)
                {
                    //元素超出9个就用上下滑动控件;
                    completeView.Show(count).AddChidren(vV);
                    vV.AddChidren(lockView.Show());
                }
                else
@@ -245,8 +242,6 @@
                }
            }
            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
            {
                var lockConditionsInfo = new Dictionary<string, string>();
ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs
@@ -538,21 +538,6 @@
                        {
                            Common.Logic.CurrentLogic.Conditions.Remove(conditions);
                            selecteddevice.selecetdFrameLayout.RemoveFromParent();
                            var exist = Common.Logic.CurrentLogic.Conditions.Find((obj) => obj["Type"] == "7");
                            if (exist == null)
                            {
                                //如果找不到地理位置作为条件的话,关闭GPS服务(减少耗电)
                                if (Send.It_Exist == "1")
                                {
                                    Application.StopGPSLocationService();
                                    Send.SaveLocalFile("GPS_File", "0");
                                }
                            }
                            //var logicCommunalPage = new LogicCommunalPage();
                            //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                            //UserView.HomePage.Instance.PageIndex += 1;
                            //logicCommunalPage.Show(() => { });
                        };
                    };
ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
old mode 100755 new mode 100644
@@ -142,24 +142,9 @@
        /// <param name="user"></param>
        public void User(Send.MembershipIfon user)
        {
            //元素超出9个就用上下滑动控件;
            VerticalScrolViewLayout vV = null;
            int count = user.UserIdMode.Count;
            if (count > 9)
            {
                ///元素超出9个;
                count = 6;
                //元素超出9个就用上下滑动控件;
                vV = new VerticalScrolViewLayout
                {
                    Y = Application.GetRealHeight(140 + 20),
                    Height = Application.GetRealHeight(160 * count),
                };
                //清除之前的控件;
                vV.RemoveAll();
            }
            int count = user.UserIdMode.Count;
            #region  -------取消   完成
            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
            this.AddChidren(flMain);
@@ -173,7 +158,23 @@
            };
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
            //元素超出9个就用上下滑动控件;
            VerticalScrolViewLayout vV = null;
            if (count > 9)
            {
                ///元素超出9个;
                count = 6;
                //元素超出9个就用上下滑动控件;
                vV = new VerticalScrolViewLayout
                {
                    Y = Application.GetRealHeight(140 + 20),
                    Height = Application.GetRealHeight(160 * count),
                };
                //元素超出9个就用上下滑动控件;
                completeView.Show(count).AddChidren(vV);
                //清除之前的控件;
                vV.RemoveAll();
            }
            #endregion
            ///定两个变量记录之前的只值;
            string userId = "";
@@ -187,8 +188,7 @@
                mFunView lockView = new mFunView();
                if (user.UserIdMode.Count > 9)
                {
                    //元素超出9个就用上下滑动控件;
                    completeView.Show(count).AddChidren(vV);
                    vV.AddChidren(lockView.Show());
                }
                else
ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -901,6 +901,30 @@
            UserView.HomePage.Instance.RemoveViewByTag("Logic");//移除所有标记Logic界面
            if (LogicView.IfString._Logic == if_logic)
            {
                //查询逻辑是否添加地理位置作为条件
                var exist = Common.Logic.CurrentLogic.Conditions.Find((obj) => obj["Type"] == "7");
                if (exist==null)
                {
                    //如果找不到地理位置作为条件的话,关闭GPS服务(减少耗电)
                    if (Send.It_Exist == "1")
                    {
                        //关闭GPS服务
                        Application.StopGPSLocationService();
                        //保存GPS服务关闭状态
                        Send.SaveLocalFile("GPS_File", "0");
                    }
                }
                else
                {
                    if (Send.It_Exist == "0")
                    {
                        //开启GPS服务
                        Application.StartGPSLocationService();
                        //保存GPS服务开启状态
                        Send.SaveLocalFile("GPS_File", "1");
                    }
                }
                //只刷新分类-自动化上下滑动view;
                Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
                // Category.Category.instance?.RefreshBodyView();
ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -23,7 +23,9 @@
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                List<int> logicIdList = new List<int>();
                bool if_theme = false;
                int if_number = -1;
                Action<string, string> action = (topic, data) =>
                {
                    var gatewayID = topic.Split('/')[0];
@@ -35,19 +37,19 @@
                    
                    if (topic == $"{gatewayID}/Logic/GetLogicList_Respon")
                    {
                        var list = jObjectdata["Data"]["LogicList"];
                        if (list == null)
                        if_theme = true;
                        var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jObjectdata["Data"]["LogicList"].ToString());
                        if_number = list.Count;
                        if (list.Count == 0)
                        {
                            return;
                        }
                        foreach (var listIfon in list)
                        {
                            var logicId = int.Parse(listIfon["LogicId"].ToString());
                            var logicId = int.Parse(listIfon["LogicId"]);
                            logicIdList.Add(logicId);
                           
                        }
                    }
                };
                var mainGateWay = ZbGateway.MainGateWay;
@@ -73,9 +75,13 @@
                while ((DateTime.Now - dateTime).TotalMilliseconds < 3 * 1000)
                {
                    await System.Threading.Tasks.Task.Delay(100);
                    if (logicIdList.Count != 0)
                    if (if_theme)
                    {
                        break;
                        if (if_number == 0 || if_number == logicIdList.Count)
                        {
                            break;//回复没有数据立刻返回
                        }
                    }
                }
                ZbGateway.MainGateWay.GwResDataAction -= action;
@@ -104,7 +110,6 @@
                    if (topic == $"{gatewayID}/Logic/GetLogicInfo_Respon")
                    {
                        logic = new Common.Logic();
                        var Logicifon = jObjectdata["Data"];
                        logic.LogicId = int.Parse(Logicifon["LogicId"]?.ToString());
@@ -249,7 +254,6 @@
                    {
                        try
                        {
                            Logicifon = new Common.Logic();
                            Logicifon = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.Logic>(jObjectdata["Data"].ToString());
                        }
                        catch (Exception ex)
@@ -652,8 +656,7 @@
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                var listLogic = new List<Common.Logic>();
                // bool @bool = false;
                var listLogic = new List<Common.Logic>();
                Action<string, string> action = (topic, data) =>
                {
                    var gatewayID = topic.Split('/')[0];
@@ -665,7 +668,6 @@
                    if (topic == $"{gatewayID}/Logic/GetAllLogicListInfo_Respon")
                    {
                        var logic = new Common.Logic();
                        var Logicifon = jObjectdata["Data"];
                        logic.LogicId = int.Parse(Logicifon["LogicId"].ToString());
@@ -724,10 +726,7 @@
                        }
                    }
                    //if (topic == $"{gatewayID}/Logic/AllLogicNum_Respon")
                    //{
                    //    @bool = true;
                    //}
                };
                var mainGateWay = ZbGateway.MainGateWay;
                if (mainGateWay == null)
@@ -752,10 +751,6 @@
                    {
                        break;
                    }
                    //if (@bool)
                    //{
                    //    break;
                    //}
                }
                ZbGateway.MainGateWay.GwResDataAction -= action;
                return listLogic;
@@ -805,7 +800,7 @@
                while ((DateTime.Now - dateTime).TotalMilliseconds < 3 * 1000)
                {
                    await System.Threading.Tasks.Task.Delay(100);
                    if (sceneui != null)
                    if (sceneui != null && sceneui.Id > 0)
                    {
                        break;
                    }
@@ -1332,8 +1327,9 @@
        {
            get
            {
                string value = ReadLocalFile("GPS_File");
                //读取本地GPS服务状态
                if (ReadLocalFile("GPS_File") == "0")
                if (value == "0"||string.IsNullOrEmpty(value))
                {
                    return "0";
                }