陈嘉乐
2021-03-16 6a7a5797af489455bbae8db46c30ec229fc2a020
2021-3-16-1
11个文件已修改
262 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,36 +1,34 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Mqtt/MqttClient.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="389" Column="22" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="250" Column="36" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="378" Column="17" />
      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="293" Column="55" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="154" Column="72" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="132" Column="75" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="70" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="14" Column="91" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="59" Column="65" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="215" Column="81" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="214" Column="1" />
      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="637" Column="18" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="220" Column="55" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs" Line="167" Column="20" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="232" Column="70" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs" Line="104" Column="45" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="504" Column="10" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="256" Column="72" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="341" Column="41" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="45" Column="19" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="223" Column="28" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="271" Column="71" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="233" Column="78" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="98" Column="15" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="264" Column="56" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="169" Column="26" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="14" Column="40" />
      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="304" Column="34" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="DAL" expanded="True">
                <Node name="Mqtt" expanded="True">
                  <Node name="MqttClient.cs" selected="True" />
                </Node>
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI2" expanded="True">
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="PirDevice" expanded="True">
                      <Node name="View" expanded="True" />
                      <Node name="DeviceSet.cs" selected="True" />
                    </Node>
                    <Node name="PirDevice" expanded="True" />
                  </Node>
                </Node>
              </Node>
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -298,7 +298,7 @@
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString;
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.controldata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
@@ -307,7 +307,7 @@
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString;
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.buttondata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -134,11 +134,12 @@
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        Method method = new Method();
                        var mqttdate = method.MqttDate(control.sid, 25);
                        if (mqttdate !=null)
                        Method.buttondata = "";
                        var mqttdate = method.MqttDate("按键", control.sid, 25);
                        if (mqttdate != null)
                        {
                            //休眠是为显示引导界面
                           // System.Threading.Thread.Sleep(3000);
                            // System.Threading.Thread.Sleep(3000);
                            //移除添加按钮引导界面
                            replication.RemView();
                            var buttonName = control.status.Find((c) => c.value == buttonObj.value);
@@ -173,12 +174,12 @@
                            new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                        }
                    }
                    else
                    {
                        Method method = new Method();
                        method.ErrorShow(responsePackNew);
                        method.ErrorShow(responsePackNew, "");
                    }
                });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -253,7 +253,7 @@
                                }
                                else {
                                    Method method = new Method();
                                    method.ErrorShow(responsePackNew);
                                    method.ErrorShow(responsePackNew,"");
                                }
                            });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -127,7 +127,7 @@
                                else
                                {
                                    Method methodError = new Method();
                                    methodError.ErrorShow(responsePackNew);
                                    methodError.ErrorShow(responsePackNew,"");
                                }
                            });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
@@ -261,7 +261,7 @@
                else
                {
                    Method method = new Method();
                    method.ErrorShow(responsePackNew);
                    method.ErrorShow(responsePackNew,"");
                }
            }, id, "品牌红外码库列表");
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -258,7 +258,7 @@
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew);
                            method.ErrorShow(responsePackNew,"");
                        }
                    });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -84,7 +84,7 @@
                                else
                                {
                                    Method methodError = new Method(); 
                                    methodError.ErrorShow(responsePackNew);
                                    methodError.ErrorShow(responsePackNew,"");
                                }
                            });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -84,7 +84,8 @@
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        string sid = responsePackNew.Data.ToString();
                        mqttdate = MqttDate(sid);
                        controldata = "";
                        mqttdate = MqttDate("遥控器", sid);
                        if (mqttdate != null)
                        {
                            control.sid = sid;
@@ -336,37 +337,51 @@
        /// <summary>
        /// MQTT主题推送下来的数据
        /// MQTT主题推送下来的遥控器数据
        /// </summary>
        public static string mqttdata = "";
        public static string controldata = "";
        /// <summary>
        /// MQTT主题推送下来按键的数据
        /// </summary>
        public static string buttondata = "";
        /// <summary>
        /// 判断这个主题是否是添加遥控器主题
        /// </summary>
        /// <param name="text">表示不同主题数据</param>
        /// <param name="sid">唯一标识</param>
        /// <param name="timeValue">等待时间值</param>
        /// <returns></returns>
        public Cloud MqttDate(string sid, int timeValue = 10)
        public Cloud MqttDate(string text, string sid, int timeValue = 10)
        {
            Cloud cloud = null;
            var dateTime = DateTime.Now;
            while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000)
            {
                if (!string.IsNullOrEmpty(mqttdata))
                string str = "";
                if (str == "遥控器")
                {
                    str = controldata;
                }
                else if (str == "按键")
                {
                    str = buttondata;
                }
                if (!string.IsNullOrEmpty(controldata))
                {
                    try
                    {
                        var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(mqttdata);
                        var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(str);
                        for (int i = 0; i < cloudjson.objects.Count; i++)
                        {
                            var objects = cloudjson.objects[i];
                            if (sid == objects.sid)
                            {
                                cloud = cloudjson;
                                mqttdata = "";
                                break;
                            }
                        }
                        if (cloud!=null)
                        if (cloud != null)
                        {
                            break;
                        }
@@ -381,44 +396,63 @@
        /// 错误码提示
        /// </summary>
        /// <param name="responsePackNew"></param>
        /// <param name="str"></param>
        public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "")
        /// <param name="text">自定义错误文本</param>
        /// <param name="popValue">弹框类型(1=闪烁弹框)</param>
        public void ErrorShow(ResponsePackNew responsePackNew, string text, int popValue = 1)
        {
            if (str == "删除遥控器")
            string str = "";
            if (text == "删除遥控器")
            {
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
            } else if (str == "读取红外宝列表失败") {
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox("读取红外宝列表失败");
                str = Language.StringByID(StringId.delFail);
            }
            else if (text == "读取红外宝列表失败")
            {
                str = "读取红外宝列表失败"; //Language.StringByID(StringId.delFail);
            }
            else
            {
                if (responsePackNew != null)
                {
                    switch (responsePackNew.Code)
                    {
                        case "14005":
                            {
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
                                str = Language.StringByID(StringId.gatewayNotOnline);
                            }
                            break;
                        case "10807":
                            {
                                //红外宝下遥控器超过最大(10个)数量限制
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox("红外宝下遥控器超过最大(10个)数量限制");
                                str = "红外宝下遥控器超过最大(10个)数量限制";// Language.StringByID(StringId.gatewayNotOnline);
                            }
                            break;
                        case "2":
                            {
                                str = "系统维护中~请稍后再试~";
                            }
                            break;
                        default:
                            {
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                                str ="获取数据失败" ;// Language.StringByID(StringId.saveFail);
                            }
                            break;
                    }
                }
            }
            switch (popValue)
            {
                case 1:
                    {
                        new Intelligence.Automation.LogicView.TipPopView().FlashingBox(str);
                    }
                    break;
                case 2: { } break;
                case 3: { } break;
            }
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -78,7 +78,7 @@
            };
            pirDeviceFLayout.AddChidren(text2Btn);
            //
            //红外宝数量
            Button numberDeviceBtn = new Button
            {
                Y = Application.GetRealHeight(137),
@@ -105,7 +105,7 @@
                TextID = StringId.dangqianhongwaishebei,
            };
            pirDeviceFLayout.AddChidren(numberDeviceTextBtn);
            //
            //所有红外宝的遥控器数量
            Button currDeviceNumberControlBtn = new Button
            {
                Y = Application.GetRealHeight(137),
@@ -135,7 +135,7 @@
            ///红外宝点击事件
            FrameLayout clickFLayout = new FrameLayout();
            pirDeviceFLayout.AddChidren(clickFLayout);
            FrameLayout deviceListFLayout = new FrameLayout();
            deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12);
@@ -174,8 +174,15 @@
            deviceListFLayout.AddChidren(deviceNameBtn);
            if (Pir.pirDeviceList.Count != 0)
            {
                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                Pir.currPir = Pir.pirDeviceList[0];
                int sum = 0;
                for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                {
                    sum += Pir.pirDeviceList[i].FunctioList.Count;
                }
                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
            }
            //下拉图标
@@ -274,17 +281,28 @@
                }
            };
            ///
            clickFLayout.MouseUpEventHandler += (sender, e) =>
            {
                DeviceSet deviceSet = new DeviceSet();
                MainPage.BasePageView.AddChidren(deviceSet);
                deviceSet.Show(() => {
                deviceSet.Show(() =>
                {
                    if (Pir.currPir != null)
                    {
                        deviceNameBtn.Text = Pir.currPir.name;
                        deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                        numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                    }
                    int sum = 0;
                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                    {
                        sum += Pir.pirDeviceList[i].FunctioList.Count;
                    }
                    currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
                });
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
@@ -347,45 +365,61 @@
                    }
                    else
                    {
                        var strings = GetTypeString(if_value).Split('-');
                        var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]);
                        if (jobDeviceType == null)
                        if (DeviceTypeList.Count == 0)
                        {
                            return;
                        }
                        GetBrandList(jobDeviceType.id, (brandList) =>
                        {
                            var brandSupportStrList = GetBrandSupport(if_value);
                            var strList = new List<string>();
                            for (int str = 0; str < brandList.Count; str++)
                            GetDeviceTypeList(true,() =>
                            {
                                string s = brandList[str].brandName;
                                var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
                                if (bool_if != null)
                                {
                                    strList.Add(s);
                                }
                                DeviceTypeViewClick(if_value);
                            }
                            Application.RunOnMainThread(() =>
                            {
                                BrandList brandObj = new BrandList();
                                MainPage.BasePageView.AddChidren(brandObj);
                                brandObj.Show(brandList, strList, strings[1]);
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            });
                        });
                        }
                        else
                        {
                            DeviceTypeViewClick(if_value);
                        }
                    }
                };
            }
            GetDeviceTypeList();
            GetDeviceTypeList(false,() => { });
        }
        /// <summary>
        /// 设备进入下一级方法
        /// </summary>
        /// <param name="if_value"></param>
        void DeviceTypeViewClick(int if_value) {
            var strings = GetTypeString(if_value).Split('-');
            var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]);
            if (jobDeviceType == null)
            {
                return;
            }
            GetBrandList(jobDeviceType.id, (brandList) =>
            {
                var brandSupportStrList = GetBrandSupport(if_value);
                var strList = new List<string>();
                for (int str = 0; str < brandList.Count; str++)
                {
                    string s = brandList[str].brandName;
                    var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
                    if (bool_if != null)
                    {
                        strList.Add(s);
                    }
                }
                Application.RunOnMainThread(() =>
                {
                    BrandList brandObj = new BrandList();
                    MainPage.BasePageView.AddChidren(brandObj);
                    brandObj.Show(brandList, strList, strings[1]);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                });
            });
        }
        /// <summary>
        /// 获取品牌支持
        /// </summary>
@@ -551,7 +585,9 @@
        /// <summary>
        /// 读取红外设备类型列表
        /// </summary>
        private void GetDeviceTypeList()
        /// <param name="tag">标识要不要提示(true=提示)</param>
        /// <param name="action">回调函数</param>
        private void GetDeviceTypeList(bool tag,Action action)
        {
            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
            {
@@ -574,11 +610,14 @@
                            }
                        }
                    }
                    action();
                }
                else
                {
                    Method method = new Method();
                    method.ErrorShow(responsePackNew);
                    if (tag) {
                        Method method = new Method();
                        method.ErrorShow(responsePackNew,"");
                    }
                }
            }, "", "设备类型列表");
        }
@@ -614,7 +653,7 @@
                else
                {
                    Method method = new Method();
                    method.ErrorShow(responsePackNew);
                    method.ErrorShow(responsePackNew,"");
                }
            }, id, "品牌列表");
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -247,7 +247,7 @@
                        url = "/smart-footstone/app/ir/code/list";
                        jObject.Add("brandId", id);
                    }
                    responsePackNew = RequestServerhomeId(jObject, url);
                    responsePackNew = RequestServerhomeId(jObject, url,5);
                }
                catch { }
                finally