陈嘉乐
2021-03-09 83df0ebfbd306d0fb5a51a21a7ef2271c0c507ec
2021-3-9-1

备份代码
22个文件已修改
577 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,33 +1,47 @@
<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/Matching.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Server/NewAPI.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="45" Column="48" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="65" Column="23" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="43" Column="21" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="21" Column="25" />
      <File FileName="HDL_ON/Entity/Function/Function.cs" />
      <File FileName="HDL_ON/Entity/FunctionList.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="199" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="66" Column="58" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="68" Column="88" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="191" Column="28" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="135" Column="46" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="310" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="116" Column="21" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="136" Column="54" />
      <File FileName="HDL_ON/DAL/Server/NewAPI.cs" Line="327" Column="6" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="DAL" expanded="True">
                <Node name="DriverLayer" expanded="True" />
                <Node name="Mqtt" expanded="True" />
                <Node name="Server" expanded="True">
                  <Node name="NewAPI.cs" selected="True" />
                </Node>
              </Node>
              <Node name="Entity" expanded="True">
                <Node name="Function" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI0-Public" expanded="True" />
                <Node name="UI2" expanded="True">
                  <Node name="3-Intelligence" expanded="True">
                    <Node name="Automation" expanded="True">
                      <Node name="LogicView" expanded="True" />
                    </Node>
                  </Node>
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="PirDevice" expanded="True">
                      <Node name="Matching.cs" selected="True" />
                      <Node name="View" expanded="True" />
                    </Node>
                  </Node>
                </Node>
@@ -35,7 +49,9 @@
            </Node>
            <Node name="HDL-ON_Android" expanded="True">
              <Node name="Assets" expanded="True">
                <Node name="Phone" expanded="True" />
                <Node name="Phone" expanded="True">
                  <Node name="PirIcon" expanded="True" />
                </Node>
              </Node>
            </Node>
            <Node name="HDL-ON_iOS" expanded="True">
@@ -56,9 +72,7 @@
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore>
      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="199" column="1" />
      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="195" column="1" />
      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="188" column="1" />
      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="323" column="1" />
    </BreakpointStore>
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
  <MultiItemStartupConfigurations />
HDL-ON_Android/Assets/Language.ini
@@ -1264,6 +1264,8 @@
6071=修改名字
6072=确认删除
6073=取消
6074=遥控器不能超过10个?
7000=新建自动化
7001=编辑自动化
HDL-ON_iOS/Resources/Language.ini
@@ -1268,6 +1268,7 @@
6071=修改名字
6072=确认删除
6073=取消
6074=遥控器不能超过10个?
HDL_ON/Common/R.cs
@@ -748,7 +748,7 @@
        public const int xiugaimingzi = 6071;
        public const int querenshanchu = 6072;
        public const int quxiao = 6073;
        public const int bunengchaoguo10 = 6074;
HDL_ON/DAL/DriverLayer/Control.cs
@@ -844,7 +844,7 @@
                            case SPK.SensorSmoke:
                            case SPK.SensorWater:
                            case SPK.ClothesHanger:
                            case SPK.IrAC:
                            case SPK.AcIr:
                                //设备状态推送
                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
                                break;
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -197,10 +197,17 @@
                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found",
                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                    };
                    //App订阅遥控器自学按键学习成功通知
                    var study = new MqttTopicFilter()
                    {
                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up",
                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                    };
                    Utlis.WriteLine("开始订阅!");
                    var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {
                        pirStatus,
                         study,
                        topicFilterPush2, topicAlinkStatus });
                    if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
                    {
@@ -291,7 +298,16 @@
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString;
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontrondata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
                                //App订阅遥控器自学按键学习成功通知
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up")
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.studybtndata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
HDL_ON/DAL/Server/NewAPI.cs
@@ -325,6 +325,7 @@
        /// 获取设备详情
        /// </summary>
        public const string Api_Post_GetDevcieInfoList = "/home-wisdom/app/device/info";
        /// <summary>
        /// 刷新设备状
        /// </summary>
@@ -502,6 +503,10 @@
        /// 遥控器自学按键删除
        /// </summary>
        public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove";
        /// <summary>
        /// 获取设备详情通过(spk,sid)
        /// </summary>
        public const string Api_Post_GetinfoBySid = "/home-wisdom/app/device/infoBySid";
        #endregion
HDL_ON/Entity/Function/Function.cs
@@ -1016,9 +1016,9 @@
        /// </summary>
        public const string IrModule = "ir.module";
        /// <summary>
        /// 红外空调
        /// 红外电视
        /// </summary>
        public const string IrAC = "ir.ac";
        public const string TvIr = "ir.tv";
        /// <summary>
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -133,7 +133,7 @@
                        var clothesHangerpage = new ClothesHangerPage();
                        clothesHangerpage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor);
                        break;
                    case SPK.IrAC:
                    case SPK.AcIr:
                    case SPK.AcStandard:
                        var acPage = new AcControlPage();
                        acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor);
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -892,9 +892,9 @@
        /// 信息提示窗口,自动关闭
        /// </summary>
        /// <param name="msg">提示错误文本</param>
        public void FlashingBox(string msg)
        public void FlashingBox(string msg,int time=2000)
        {
            new PublicAssmebly().TipMsgAutoClose(msg, false, 2000);
            new PublicAssmebly().TipMsgAutoClose(msg, false, time);
        }
        /// <summary>
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -114,7 +114,7 @@
                    //名称不能为空
                    return;
                }
                var butName = Pir.BuottonList.Find((c) => c.value == texts);
                var butName = control.status.Find((c) => c.value == texts);
                if (butName != null)
                {
                    //名称已经存在
@@ -126,41 +126,54 @@
                //添加数据对象
                Entity.AttributesStatus buttonObj = new Entity.AttributesStatus();
                buttonObj.key = "key" + Pir.BuottonList.Count.ToString();
                buttonObj.key = "key" + control.status.Count.ToString();
                buttonObj.value = texts;
                PirSend.CodeStudy(control, buttonObj, (responsePackNew) =>
                {
                    //休眠是为显示引导界面
                    System.Threading.Thread.Sleep(5000);
                    //移除添加按钮引导界面
                    replication.RemView();
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        var buttonName = Pir.BuottonList.Find((c) => c.value == buttonObj.value);
                        if (buttonName == null)
                        Method method = new Method();
                        var mqttdate = method.MqttDate(control.sid, 20);
                        if (mqttdate !=null)
                        {
                            //添加数据
                            Pir.BuottonList.Add(buttonObj);
                        }
                        //移除添加按钮界面
                        this.RemoveFromParent();
                        for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
                        {
                            var view = MainPage.BasePageView.GetChildren(i);
                            if (view.GetType() == typeof(AddControl))
                            //休眠是为显示引导界面
                           // System.Threading.Thread.Sleep(3000);
                            //移除添加按钮引导界面
                            replication.RemView();
                            var buttonName = control.status.Find((c) => c.value == buttonObj.value);
                            if (buttonName == null)
                            {
                                view.RemoveFromParent();
                                //添加数据
                                control.status.Add(buttonObj);
                            }
                            //移除添加按钮界面
                            this.RemoveFromParent();
                            for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
                            {
                                var view = MainPage.BasePageView.GetChildren(i);
                                if (view.GetType() == typeof(AddControl))
                                {
                                    new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                                    view.RemoveFromParent();
                                }
                            }
                            //加载数据界面
                            AddControl addControl = new AddControl();
                            MainPage.BasePageView.AddChidren(addControl);
                            addControl.Show(control);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        }
                        else
                        {
                            replication.RemView();
                            new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                        //加载数据界面
                        AddControl addControl = new AddControl();
                        MainPage.BasePageView.AddChidren(addControl);
                        addControl.Show(control);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        }
                    }
                    else
                    {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -103,7 +103,7 @@
            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
            frameLayout.AddChidren(vv);
            RefreshView(vv, false);
            RefreshView(vv, false, control);
            #endregion
            #region  界面点击事件
@@ -117,13 +117,13 @@
                    topView.topIconBtn.Text = Language.StringByID(StringId.wancheng);
                    topView.topIconBtn.TextSize = TextSize.text14;
                    topView.topIconBtn.TextColor = CSS.CSS_Color.textColor;
                    RefreshView(vv, true);
                    RefreshView(vv, true, control);
                }
                else
                {
                    topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png";
                    topView.topIconBtn.Text = "";
                    RefreshView(vv, false);
                    RefreshView(vv, false, control);
                }
@@ -164,18 +164,18 @@
        /// </summary>
        /// <param name="vv">上下滑动控件</param>
        /// <param name="if_bool">表示是否显示删除图标</param>
        void RefreshView(VerticalScrolViewLayout vv, bool if_bool)
        void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control)
        {
            vv.RemoveAll();
            //定义一个变量记录行数
            int sum = 0;
            if (Pir.BuottonList.Count % 3 == 0)
            if (control.status.Count % 3 == 0)
            {
                sum = Pir.BuottonList.Count / 3;
                sum = control.status.Count / 3;
            }
            else
            {
                sum = Pir.BuottonList.Count / 3 + 1;
                sum = control.status.Count / 3 + 1;
            }
            //计算加载出来的数据需要的高度
            int h = 16 + sum * (16 + 44) + 104 + 76;
@@ -186,9 +186,9 @@
                Height = Application.GetRealWidth(h),
            };
            vv.AddChidren(FLayout);
            for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++)
            for (int i = 1, j = 0; i <= control.status.Count; i++, j++)
            {
                var nameObj = Pir.BuottonList[i - 1];
                var nameObj = control.status[i - 1];
                //按钮
                var buttonNameBtn = new Button
                {
@@ -245,12 +245,12 @@
                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                {
                                    ///这里:监听MTTP推送下来主题,才知道是否添加成功
                                    var buttonObj = Pir.BuottonList.Find((c) => c.value == obj.value);
                                    var buttonObj = control.status.Find((c) => c.value == obj.value);
                                    if (buttonObj != null)
                                    {
                                        Pir.BuottonList.Remove(buttonObj);
                                        control.status.Remove(buttonObj);
                                    }
                                    RefreshView(vv, true);
                                    RefreshView(vv, true, control);
                                }
                                else {
                                    Method method = new Method();
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -116,10 +116,10 @@
                else
                {
                    Method method = new Method();
                    method.AddControl(this, (control1) => {
                    method.AddControl(this, (controlDevice) => {
                        AddButton addButton = new AddButton();
                        MainPage.BasePageView.AddChidren(addButton);
                        addButton.Show(control1);
                        addButton.Show(controlDevice);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    });
                }
@@ -129,6 +129,21 @@
            {
                MainPage.BasePageView.RemoveViewByTag("AddControl");
                MainPage.BasePageView.RemoveViewByTag("Pir");
                Entity.Function function = new Entity.Function();
                function.sid = control.sid;
                function.deviceId = control.deviceId;
                function.name = control.name;
                function.spk = control.spk;
                function.attributes.AddRange(function.attributes);
                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
                {
                    Pir.currPir.FunctioList.Add(function);
                }
                //Entity.FunctionAttributes functionAttributes = new Entity.FunctionAttributes();
                //functionAttributes.key
            };
            #endregion
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -11,7 +11,7 @@
        {
            Tag = "PirView";
        }
        public void Show()
        public void Show(Action action)
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
@@ -19,7 +19,10 @@
            topView.topNameBtn.TextID = StringId.shebeigaunli;
            topView.topIconBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => {
                action();
                this.RemoveFromParent();
            };
            VerticalRefreshLayout vv = new VerticalRefreshLayout();
            vv.Height = Application.GetRealHeight(667 - 64);
            vv.Y = Application.GetRealHeight(64);
@@ -147,6 +150,7 @@
                    Width = Application.GetRealWidth(8),
                    Height = Application.GetRealWidth(8),
                    UnSelectedImagePath = "PirIcon/online.png",
                    SelectedImagePath = "PirIcon/offline.png",
                };
                devfLayout.AddChidren(stateIconBtn);
                //红外宝状态(在线-离线)
@@ -160,9 +164,17 @@
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
                    SelectedTextColor =CSS.CSS_Color.textRedColor,
                    IsBold = true,
                };
                devfLayout.AddChidren(stateTextBtn);
                if (pirDevice.online) {
                    stateIconBtn.IsSelected = true;
                    stateTextBtn.IsSelected = true;
                } else {
                    stateIconBtn.IsSelected = false;
                    stateTextBtn.IsSelected = false;
                }
                //线
                Button lineBtn = new Button
                {
@@ -302,7 +314,11 @@
                                    {
                                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                        {
                                            pirDevice.FunctioList.Remove(Function);
                                            var function = pirDevice.FunctioList.Find((c)=>c.sid== Function.sid);
                                            if (function != null)
                                            {
                                                pirDevice.FunctioList.Remove(Function);
                                            }
                                            UIView(vv);
                                        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -247,11 +247,11 @@
                        }
                    }
                    break;
                case SPK.ElectricTV:
                case SPK.TvIr:
                    {
                        switch (textInt)
                        {
                            case StringId.dianshi:
                            case StringId.dianyuan:
                                {
                                    key = "on_off";
                                    value = "on";
@@ -259,8 +259,8 @@
                                break;
                            case StringId.yinliangjia:
                                {
                                    key = "on_off";
                                    value = "on";
                                    key = "volume+";
                                    value = "50";
                                }
                                break;
                            case StringId.jingyin:
@@ -284,6 +284,7 @@
            control.type = "library";
            control.status.Add(buttonObj);
            control.deviceId = Pir.currPir.deviceId;
            control.sid = "";
            string[] strings = library.irCode.Split(',');
            for (int arrayStr = 0; arrayStr < strings.Length; arrayStr++) 
            {
@@ -368,7 +369,7 @@
                        }
                    }
                    break;
                case SPK.ElectricTV:
                case SPK.TvIr:
                    {
                        switch (code)
                        {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -16,14 +16,20 @@
            View.TipView tipView = new View.TipView();
            tipView.InputBox(frameLayout, "", (name, frame) =>
             {
                 ///清除之前列表数据
                 Pir.BuottonList.Clear();
                 Control control = new Control();
                 control.name = name;
                 control.type = "learn";
                 control.spk = "ir.learn";
                 control.deviceId = Pir.currPir.deviceId;
                 ThreadAddControl(control, frame, action);
                 if (Pir.currPir != null && Pir.currPir.FunctioList.Count < 10)
                 {
                     Control control = new Control();
                     control.name = name;
                     control.type = "learn";
                     control.spk = "ir.learn";
                     control.deviceId = Pir.currPir.deviceId;
                     ThreadAddControl(control, frame, action);
                 }
                 else
                 {
                     View.TipView tt = new View.TipView();
                     tt.TipBox(StringId.tip, StringId.bunengchaoguo10);
                 }
             }, false);
        }
@@ -54,13 +60,20 @@
                        {
                            string sid = responsePackNew.Data.ToString();
                            var mqttdate = MqttDate(sid);
                            if (mqttdate.id!="")
                            if (mqttdate != null)
                            {
                                ///这里:监听MTTP推送下来主题,才知道是否添加成功
                                frame.RemoveFromParent();//添加成功关闭弹窗
                                control.deviceId = mqttdate.id;
                                control.sid = sid;
                                action(control);
                                //休眠500毫秒,为等待云端创建deviceid;
                                System.Threading.Thread.Sleep(500);
                                GetControl(frame, control,(device)=> {
                                    if (device != null)
                                    {
                                        control.deviceId = device.deviceId;
                                        frame.RemoveFromParent();//添加成功关闭弹窗
                                        action(control);
                                    }
                                });
                            }
                            else
                            {
@@ -232,27 +245,85 @@
        }
        /// <summary>
        /// 获取遥控器详细
        /// </summary>
        public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action)
        {
            Entity.Function function = null;
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    responsePackNew = PirSend.GetinfoBySid(control);
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        try
                        {
                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                            {
                                var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString());
                                function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                            }
                            else
                            {
                                Method method = new Method();
                                method.ErrorShow(responsePackNew);
                            }
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                action(function);
                            });
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// MQTT主题推送下来的数据(遥控器添加)
        /// </summary>
        public static string addcontronsid = "";
        public static string addcontrondata = "";
        /// <summary>
        /// MQTT主题推送下来的数据(学习按键)
        /// </summary>
        public static string studybtndata = "";
        /// <summary>
        /// 判断这个主题是否是添加遥控器主题
        /// </summary>
        /// <returns></returns>
        public Cloud MqttDate(string sid)
        public Cloud MqttDate(string sid,int timeValue=10)
        {
            Cloud cloud = new Cloud();
            Cloud cloud=null;
            var dateTime = DateTime.Now;
            while ((DateTime.Now - dateTime).TotalMilliseconds < 10 * 1000)
            while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000)
            {
                if (!string.IsNullOrEmpty(addcontronsid))
                if (!string.IsNullOrEmpty(addcontrondata))
                {
                    cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid);
                    for (int i = 0; i < cloud.objects.Count; i++)
                   var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontrondata);
                    for (int i = 0; i < cloudjson.objects.Count; i++)
                    {
                        var objects = cloud.objects[i];
                        var objects = cloudjson.objects[i];
                        if (sid == objects.sid)
                        {
                            cloud = cloudjson;
                            break;
                        }
                    }
@@ -289,7 +360,7 @@
        /// <summary>
        /// 设备id
        /// </summary>
        public string id ="";
        public string id = "";
        public List<Objects> objects = new List<Objects>();
        public string time_stamp = string.Empty;
@@ -301,6 +372,14 @@
        public string sid = string.Empty;
        public string spk = string.Empty;
        public List<Attributes> attributes = new List<Attributes>();
    }
    [Serializable]
    public class Attributes
    {
        public string key = "";
        public string data_type = "";
        public List<string> value = new List<string>();
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -5,12 +5,11 @@
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    [System.Serializable]
    public class Pir: Entity.Function
    public class Pir : Entity.Function
    {
        /// <summary>
        /// 添加按键列表
        /// 红外宝列表
        /// </summary>
        public static List<AttributesStatus> BuottonList = new List<AttributesStatus>();
        public static List<Pir> pirDeviceList = new List<Pir>();
        /// <summary>
        /// 当前逻辑
@@ -22,7 +21,6 @@
        public List<Entity.Function> FunctioList = new List<Entity.Function>();
    }
    [System.Serializable]
    public class Control
@@ -30,15 +28,15 @@
        /// <summary>
        /// 红外宝设备Id
        /// </summary>
        public string deviceId = "0";
        public string deviceId = "";
        /// <summary>
        /// sid
        /// </summary>
        public string sid = "0";
        public string sid = "";
        /// <summary>
        /// 红外遥控器名称
        /// </summary>
        public string name = "0";
        public string name = "";
        /// <summary>
        /// 红外遥控器spk
        /// </summary>
@@ -50,13 +48,13 @@
        /// <summary>
        /// 码组号
        /// </summary>
        public string groupId = "12";
        public string groupId = "";
        /// <summary>
        /// 红外码
        /// 红外码库
        /// </summary>
        public List<string> library = new List<string>();
        /// <summary>
        /// 红外码
        ///
        /// </summary>
        public List<AttributesStatus> status = new List<AttributesStatus>();
    }
@@ -90,7 +88,6 @@
        public string brandName = string.Empty;
    }
    public class Library
    {
        /// <summary>
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -135,14 +135,7 @@
            ///红外宝点击事件
            FrameLayout clickFLayout = new FrameLayout();
            pirDeviceFLayout.AddChidren(clickFLayout);
            clickFLayout.MouseUpEventHandler += (sender, e) =>
            {
                DeviceSet deviceSet = new DeviceSet();
                MainPage.BasePageView.AddChidren(deviceSet);
                deviceSet.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            FrameLayout deviceListFLayout = new FrameLayout();
            deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12);
@@ -282,6 +275,19 @@
            };
            clickFLayout.MouseUpEventHandler += (sender, e) =>
            {
                DeviceSet deviceSet = new DeviceSet();
                MainPage.BasePageView.AddChidren(deviceSet);
                deviceSet.Show(() => {
                    if (Pir.currPir != null)
                    {
                        deviceNameBtn.Text = Pir.currPir.name;
                    }
                });
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
            int line = 0;
            for (int i = 1, j = 0; i <= 7; i++, j++)
@@ -451,7 +457,7 @@
                case 2:
                    {
                        //电视
                        type = "tv-" + SPK.ElectricTV;
                        type = "tv-" + SPK.TvIr;
                    }
                    break;
                case 3:
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -52,6 +52,19 @@
            return responsePackNew;
        }
        /// <summary>
        /// 获取设备详情通过(spk,sid)
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew GetinfoBySid(Control control)
        {
            var jObject = new JObject { };
            jObject.Add("homeId", HomeId);
            jObject.Add("spk", control.spk);
            jObject.Add("sid", control.sid);
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetinfoBySid);
            return responsePackNew;
        }
        /// <summary>
        /// 获取遥控器列表
        /// </summary>
        public static ResponsePackNew ControlList(Pir pir)
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs
@@ -52,7 +52,6 @@
            View.SaveView saveView = new View.SaveView();
            dialog.AddChidren(saveView.FLayoutView());
            saveView.btnSave.TextID = StringId.chongshii;
            saveView.frameLayout.BackgroundColor = CSS.CSS_Color.viewLine;
            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            dialog.Show();
            saveView.btnClick.MouseUpEventHandler += (sender,e) => {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs
@@ -15,6 +15,8 @@
            Width = Application.GetRealWidth(TextSize.view375),
            Gravity = Gravity.BottomCenter,//置底的属性
            BackgroundColor = CSS.CSS_Color.view,
            BorderWidth = 1,
            BorderColor = CSS.CSS_Color.viewLine,
        };
        /// <summary>
@@ -33,6 +35,7 @@
            BackgroundColor = CSS.CSS_Color.btnSaveBackgroundColor,
            Radius = (uint)Application.GetRealHeight(22),
        };
        public Button btnClick = new Button
        {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs
@@ -326,7 +326,178 @@
        }
        /// <summary>
        /// 确定提示框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tipTxet">自定义提示文本</param>
        /// <param name="confirmAction">回调函数</param>
        public void TipBox(int titleId, int tipTxet, Action confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(140),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button titleBtn = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(270 - 35 * 2),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.Text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(titleBtn);
            Button tipBtn = new Button()
            {
                Y = titleBtn.Bottom + Application.GetRealHeight(8),
                X = Application.GetRealWidth(20),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(270 - 20 * 2),
                TextColor = CSS_Color.textTipColor,
                TextSize = TextSize.Text12,
                TextAlignment = TextAlignment.Center,
                TextID = tipTxet,
            };
            whiteView.AddChidren(tipBtn);
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.textTipColor,
                TextSize = TextSize.Text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.Text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                confirmAction();
                dialog.Close();
            };
        }
        /// <summary>
        /// 错误信息提示窗口,手动确定关闭
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="msgId">提示错误文本</param>
        public void TipBox(int titleId, int msgId)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS_Color.viewTrans60lucence,
            };
            FrameLayout contentView = new FrameLayout()
            {
                Gravity = Gravity.Center,
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(140),
                BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(contentView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                Height = Application.GetRealHeight(22),
                TextColor = CSS_Color.MainColor,
                TextSize =TextSize.Text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            contentView.AddChidren(btnTitle);
            Button btnMsg = new Button()
            {
                Height = Application.GetRealHeight(17),
                Y = Application.GetRealHeight(50),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = TextSize.Text12,
                TextID = msgId,
            };
            contentView.AddChidren(btnMsg);
            Button btnLine = new Button()
            {
                Y = Application.GetRealHeight(96),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            contentView.AddChidren(btnLine);
            Button btnConfirm = new Button()
            {
                Y = btnLine.Bottom,
                Height = Application.GetRealHeight(43),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainColor,
                TextSize = TextSize.Text16,
                TextID = StringId.Close,
            };
            contentView.AddChidren(btnConfirm);
            dialog.Show();
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
        }
    }
}