wxr
2021-03-16 7584dea0241cefc276a4b5311331aee1dcda6c80
Merge branch 'WJC' into temp-wxr
14个文件已添加
23个文件已修改
2239 ■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/1.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/2.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/3.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/4.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/failed.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/left.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/right.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL_APP_Project.sln 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 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 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs 463 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 410 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FailView.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs 351 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -1245,8 +1245,6 @@
6012=红外遥控
6013=设备管理
6014=添加遥控器
6015=在线
6016=离线
6017=版本号
@@ -1304,6 +1302,11 @@
6071=修改名字
6072=确认删除
6073=取消
6074=遥控器不能超过10个?
6075=遥控器所属区域:
6076=编辑信息
7000=新建自动化
7001=编辑自动化
@@ -1353,7 +1356,7 @@
7045=设置
7046=名称
7047=修改名称
7048=自动化名称已存在
7048=名称已存在
7049=是否要删除自动化?
7050=添加场景
7051=延时
HDL-ON_iOS/Resources/Language.ini
@@ -1248,6 +1248,66 @@
6012=红外遥控
6013=设备管理
6014=添加遥控器
6015=在线
6016=离线
6017=版本号
6018=请输入遥控器名称
6019=提示:遥控器创建后可在功能-电器分类{\r\n}查找使用
6020=推荐按键
6021=请输入按键名称
6022=下一步
6023=电源
6024=音量+
6025=音量-
6026=频道+
6027=频道-
6028=上
6029=下
6030=左
6031=右
6032=静音
6034=确认
6035=播放
6037=退出
6038=菜单
6039=暂停
6040=返回
6041=停止
6042=主页
6043=快进
6044=快退
6045=定时
6046=复制遥控功能
6047=对准遥控器中心按下相同按键
6048=智能遥控器
6049=添加按键
6050=*长按可进行自定义排序
6051=完成
6052=添加成功
6053=可到分类-功能-电器操作使用
6054=所属分类
6055=遥控器名称
6056=所属区域
6057=继续添加
6058=电器
6059=添加失败
6060=重试
6061=匹配遥控器
6062=请点击以下按钮
6063=确认设备是否有响应
6064=控制失败
6065=控制成功
6066=电源开
6067=模式制冷
6068=风速中风
6069=温度26℃
6070=删除设备
6071=修改名字
6072=确认删除
6073=取消
6074=遥控器不能超过10个?
6075=遥控器所属区域:
6076=编辑信息
6015=在线
@@ -1356,7 +1416,7 @@
7045=设置
7046=名称
7047=修改名称
7048=自动化名称已存在
7048=名称已存在
7049=是否要删除自动化?
7050=添加场景
7051=延时
HDL-ON_iOS/Resources/Phone/PirIcon/1.png
HDL-ON_iOS/Resources/Phone/PirIcon/2.png
HDL-ON_iOS/Resources/Phone/PirIcon/3.png
HDL-ON_iOS/Resources/Phone/PirIcon/4.png
HDL-ON_iOS/Resources/Phone/PirIcon/failed.png
HDL-ON_iOS/Resources/Phone/PirIcon/icon1.png
HDL-ON_iOS/Resources/Phone/PirIcon/icon2.png
HDL-ON_iOS/Resources/Phone/PirIcon/left.png
HDL-ON_iOS/Resources/Phone/PirIcon/right.png
HDL-ON_iOS/Resources/Phone/PirIcon/succeed.png
HDL_APP_Project.sln
@@ -9,6 +9,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ys", "ys\ys.csproj", "{DF065E3F-C3A1-4908-9582-000974B7C290}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
@@ -55,5 +57,17 @@
        {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU
        {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU
        {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.Build.0 = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.ActiveCfg = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.Build.0 = Debug|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.ActiveCfg = Release|Any CPU
        {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.Build.0 = Release|Any CPU
    EndGlobalSection
EndGlobal
HDL_ON/Common/R.cs
@@ -861,7 +861,9 @@
        public const int xiugaimingzi = 6071;
        public const int querenshanchu = 6072;
        public const int quxiao = 6073;
        public const int bunengchaoguo10 = 6074;
        public const int yaokongqiquyu = 6075;
        public const int bianjixinxi = 6076;
HDL_ON/DAL/DriverLayer/Control.cs
@@ -852,7 +852,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)
                    {
@@ -242,7 +249,7 @@
            Utlis.WriteLine($"StartCloudMqtt: 开始");
            await Task.Factory.StartNew(async () => {
            await Task.Factory.StartNew((Func<Task>)(async () => {
                try
                {
                    #region 初始化远程Mqtt
@@ -254,7 +261,7 @@
                    if (RemoteMqttClient.ApplicationMessageReceivedHandler == null)
                    {
                        //处理接收到的数据
                        RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => {
                        RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => {
                            try
                            {
                                var topic = e.ApplicationMessage.Topic;
@@ -301,7 +308,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.mqttdata = 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.mqttdata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
@@ -332,7 +348,7 @@
                                }
                            }
                            catch { }
                        });
                        }));
                    }
                    //(2)DisconnectedHandler
@@ -383,7 +399,7 @@
                    Utlis.WriteLine($"StartCloudMqtt: 结束");
                }
            });
            }));
        }
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,18 @@
        /// 遥控器自学按键删除
        /// </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";
        /// <summary>
        /// 红外宝/遥控器删除
        /// </summary>
        public const string API_POST_Ir_DeviceDel = "/home-wisdom/app/device/remove";
        /// <summary>
        /// 修改设备名称
        /// </summary>
        public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename";
        #endregion
@@ -513,18 +526,12 @@
        /// 河东获取萤石云子账号token的接口
        /// </summary>
        public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken";
        /// <summary>
        /// 红外宝/遥控器删除
        /// </summary>
        public const string API_POST_Ir_DeviceDel= "/home-wisdom/app/device/remove";
        /// <summary>
        /// 修改红外宝名称
        /// </summary>
        public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename";
        
        #endregion
    }
    ///// <summary>
HDL_ON/Entity/Function/Function.cs
@@ -1031,7 +1031,7 @@
        /// <summary>
        /// 家电、风扇
        /// </summary>
        public const string ElectricFan = "electrical.fan";
        public const string ElectricFan = "electrical.fan";
        /// <summary>
        /// 家电、涂鸦空气净化器
        /// </summary>
@@ -1039,7 +1039,7 @@
        /// <summary>
        /// 家电、涂鸦电风扇
        /// </summary>
        public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz";
        public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz";
        /// <summary>
        /// 家电、涂鸦扫地机器人
        /// </summary>
@@ -1057,7 +1057,7 @@
        /// </summary>
        public const string IrModule = "ir.module";
        /// <summary>
        /// 红外空调
        /// 红外电视
        /// </summary>
        public const string IrAC = "ir.ac";
        /// <summary>
HDL_ON/HDL_ON.projitems
@@ -371,6 +371,10 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\BrandListPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\IrLearnPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\EditControl.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FrameLayout50.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ControlView.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)DAL\" />
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -134,7 +134,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
@@ -8,7 +8,7 @@
    {
        public AddButton()
        {
            Tag = "Pir";
            Tag = "PirView";
        }
        public void Show(Control control)
        {
@@ -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)
                {
                    //名称已经存在
@@ -125,49 +125,61 @@
                replication.Show();
                //添加数据对象
                ButtonObj buttonObj = new ButtonObj();
                buttonObj.Key = "key" + Pir.BuottonList.Count.ToString();
                Entity.AttributesStatus buttonObj = new Entity.AttributesStatus();
                buttonObj.key = "key" + control.status.Count.ToString();
                buttonObj.value = texts;
                PirSend.CodeStudy(buttonObj, (responsePackNew) =>
                PirSend.CodeStudy(control, buttonObj, (responsePackNew) =>
                {
                    ///这里:监听MTTP推送下来主题,才知道是否添加成功
                    ///
                    //休眠是为显示引导界面
                      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)
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        //添加数据
                        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))
                        Method method = new Method();
                        var mqttdate = method.MqttDate(control.sid, 25);
                        if (mqttdate !=null)
                        {
                            view.RemoveFromParent();
                            //休眠是为显示引导界面
                           // System.Threading.Thread.Sleep(3000);
                            //移除添加按钮引导界面
                            replication.RemView();
                            var buttonName = control.status.Find((c) => c.value == buttonObj.value);
                            if (buttonName == null)
                            {
                                //添加数据
                                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 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
                    //{
                    //    PirSend.Error(responsePackNew);
                    //}
                    else
                    {
                        Method method = new Method();
                        method.ErrorShow(responsePackNew);
                    }
                });
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -9,7 +9,7 @@
    {
        public AddControl()
        {
            Tag = "Pir";
            Tag = "PirView";
        }
        public void Show(Control control)
        {
@@ -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);
                }
@@ -151,7 +151,6 @@
                        view.RemoveFromParent();
                    }
                }
                //MainPage.BasePageView.RemoveViewByTag("Pir");
                AddControlComplete addControlComplete = new AddControlComplete();
                MainPage.BasePageView.AddChidren(addControlComplete);
                addControlComplete.Show(control,false);
@@ -164,18 +163,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 +185,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
                {
@@ -223,7 +222,7 @@
                //删除图标的点击事件
                delIconBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var obj = delIconBtn.Tag as ButtonObj;
                    var obj = delIconBtn.Tag as Entity.AttributesStatus;
                    //加载log
                    Loading loading = new Loading();
                    this.AddChidren(loading);
@@ -234,7 +233,7 @@
                        try
                        {
                            //发送按键删除;
                            responsePackNew = PirSend.CodeRemove(obj);
                            responsePackNew = PirSend.CodeRemove(obj, control.deviceId);
                        }
                        catch { }
                        finally
@@ -245,12 +244,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
@@ -8,10 +8,24 @@
    {
        public AddControlComplete()
        {
            Tag = "Pir";
            Tag = "PirView";
        }
        public void Show(Control control, bool bool_library)
        {
            //数据转换
            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(control.status);
                //遥控器添加到列表;
                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
                {
                    Pir.currPir.FunctioList.Add(function);
                }
            }
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
@@ -76,12 +90,71 @@
            this.AddChidren(namePatchView.FLayoutView());
            namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
            namePatchView.btnText2.Text = control.name;
            namePatchView.btnClick.MouseUpEventHandler += (sender,e) => {
                List<string> list = new List<string>();
                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                {
                    list.Add(Pir.currPir.FunctioList[i].name);
                }
                Method method = new Method();
                method.EditControlName(StringId.editName, list, control.name, (name, view) =>
                {
                    //加载log
                    Loading loading = new Loading();
                    view.AddChidren(loading);
                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                    loading.Start();
                    new System.Threading.Thread(() =>
                    {
                        try
                        {
                            responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                {
                                    view.Close();
                                    namePatchView.btnText2.Text = name;
                                    function.name = name;
                                }
                                else
                                {
                                    Method methodError = new Method();
                                    methodError.ErrorShow(responsePackNew);
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                }, () => { });
            };
            //所属区域
            View.PatchView quyuPatchView = new View.PatchView();
            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
            this.AddChidren(quyuPatchView.FLayoutView());
            quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
            quyuPatchView.btnText2.TextID = StringId.dianqi;
            quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                Method method = new Method();
                method.ManagementPosition(function, () =>
                {
                    //更新区域
                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
                });
            };
            //继续添加
            Button addBtn = new Button
@@ -116,10 +189,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;
                    });
                }
@@ -127,8 +200,12 @@
            //完成点击事件
            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                MainPage.BasePageView.RemoveViewByTag("AddControl");
                MainPage.BasePageView.RemoveViewByTag("Pir");
                //前面界面
               // this.RemoveFromParent();
                MainPage.BasePageView.RemoveViewByTag("PirView");
                //主界面
                MainPage.BasePageView.RemoveViewByTag("PirMain");
            };
            #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,11 @@
            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);
@@ -29,14 +33,14 @@
                //关闭刷新View;
                vv.EndHeaderRefreshing();
                //获取列表
                Method.GetPirDeviceList(this,() =>
                {
                    Application.RunOnMainThread(() =>
                    {
                        //刷新界面
                        UIView(vv);
                    });
                });
                Method.GetPirDeviceList(this, () =>
                 {
                     Application.RunOnMainThread(() =>
                     {
                         //刷新界面
                         UIView(vv);
                     });
                 });
            };
            #endregion
@@ -60,138 +64,32 @@
                    Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)),
                };
                vv.AddChidren(fLayout);
                //红外宝显示父控件
                FrameLayout devfLayout = new FrameLayout
                {
                    Y = Application.GetRealHeight(12),
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(375 - 16 * 2),
                    Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)),
                    BackgroundColor = CSS.CSS_Color.view,
                    Radius = (uint)Application.GetRealHeight(12),
                };
                fLayout.AddChidren(devfLayout);
                //红外宝图标
                Button priequipmentBtn = new Button
                {
                    Y = Application.GetRealHeight(16),
                    X = Application.GetRealWidth(5),
                    Width = Application.GetRealWidth(60),
                    Height = Application.GetRealWidth(60),
                    UnSelectedImagePath = "PirIcon/priequipment.png",
                    TextAlignment = TextAlignment.Center,
                };
                devfLayout.AddChidren(priequipmentBtn);
                View.PirView pirView = new View.PirView();
                //红外宝名称
                Button deviceNameBtn = new Button
                pirView.deviceNameBtn.Text = pirDevice.name;
                //红外宝当前有多少个遥控器
                pirView.geBtn.Text = pirDevice.FunctioList.Count.ToString();
                //红外宝是否在线-离线
                if (pirDevice.online)
                {
                    Y = Application.GetRealHeight(16),
                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(20),
                    Text = pirDevice.name,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text14,
                    TextColor = CSS.CSS_Color.textColor,
                    IsBold = true,
                };
                devfLayout.AddChidren(deviceNameBtn);
                //版本号
                Button versionBtn = new Button
                    pirView.stateIconBtn.IsSelected = true;
                    pirView.stateTextBtn.IsSelected = true;
                }
                else
                {
                    Y = deviceNameBtn.Bottom + Application.GetRealHeight(4),
                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(17),
                    Text = "版本号v1.3.5",
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = CSS.CSS_Color.textCancelColor,
                };
                devfLayout.AddChidren(versionBtn);
                // 5/10
                Button geBtn = new Button
                    pirView.stateIconBtn.IsSelected = false;
                    pirView.stateTextBtn.IsSelected = false;
                }
                //标记红外宝
                pirView.clickBtn.Tag = pirDevice;
                //红外宝点击事件
                pirView.clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    Y = versionBtn.Bottom + Application.GetRealHeight(2),
                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(17),
                    Text = pirDevice.FunctioList.Count.ToString(),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = CSS.CSS_Color.textConfirmColor,
                };
                devfLayout.AddChidren(geBtn);
                geBtn.Width = geBtn.GetTextWidth();
                // 5/10
                Button sumBtn = new Button
                {
                    Y = versionBtn.Bottom + Application.GetRealHeight(2),
                    X = geBtn.Right,
                    Width = Application.GetRealWidth(20),
                    Height = Application.GetRealHeight(17),
                    Text = "/10",
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = CSS.CSS_Color.textCancelColor,
                };
                devfLayout.AddChidren(sumBtn);
                //状态图标
                Button stateIconBtn = new Button
                {
                    Y = Application.GetRealHeight(23),
                    X = Application.GetRealWidth(291),
                    Width = Application.GetRealWidth(8),
                    Height = Application.GetRealWidth(8),
                    UnSelectedImagePath = "PirIcon/online.png",
                };
                devfLayout.AddChidren(stateIconBtn);
                //红外宝状态(在线-离线)
                Button stateTextBtn = new Button
                {
                    Y = Application.GetRealHeight(18),
                    X = Application.GetRealWidth(303),
                    Width = Application.GetRealWidth(30),
                    Height = Application.GetRealHeight(17),
                    TextID = StringId.zaixianhwb,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
                    IsBold = true,
                };
                devfLayout.AddChidren(stateTextBtn);
                //线
                Button lineBtn = new Button
                {
                    Y = Application.GetRealHeight(92) - 1,
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(343 - 16 * 2),
                    Height = 1,
                    BackgroundColor = CSS.CSS_Color.viewLine,
                };
                devfLayout.AddChidren(lineBtn);
                //点击事件
                FrameLayout clickFram = new FrameLayout
                {
                    Y = Application.GetRealHeight(12),
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(375 - 16 * 2),
                    Height = Application.GetRealHeight(92),
                    BackgroundColor = 0x00000000, //CSS.CSS_Color.view,
                    Radius = (uint)Application.GetRealHeight(12),
                    Tag = Pir.pirDeviceList[i],
                };
                fLayout.AddChidren(clickFram);
                clickFram.MouseUpEventHandler += (sender, e) =>
                {
                    var pirclick = (clickFram.Tag as Pir);
                    var pirclick = (pirView.clickBtn.Tag as Pir);
                    NewSwitchView(pirclick, vv);
                };
                //加载界面
                pirView.Show(pirDevice.FunctioList.Count, fLayout);
                if (Pir.pirDeviceList.Count - 1 == i)
                {
                    //最后一个后面增加间隔背景
@@ -201,128 +99,65 @@
                for (int j = 0; j < pirDevice.FunctioList.Count; j++)
                {
                    var control = pirDevice.FunctioList[i];
                    RowLayout funControlRow = new RowLayout
                    {
                        Y = Application.GetRealHeight(92 + (50 * j)),
                        Width = Application.GetRealWidth(375 - 16 * 2),
                        Height = Application.GetRealHeight(50),
                        LineColor = CSS.CSS_Color.textWhiteColor,
                        SubViewWidth = Application.GetRealWidth(68),
                    };
                    devfLayout.AddChidren(funControlRow);
                    var control = pirDevice.FunctioList[j];
                    View.ControlView controlView = new View.ControlView();
                    controlView.Show(pirView.devfLayout, j);
                    //遥控器名称
                    Button nameBtn = new Button
                    controlView.nameBtn.Text = control.name;
                    //遥控器存放区域
                    controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
                    //标记遥控器
                    controlView.delBtn.Tag = control;
                    //删除点击事件
                    controlView.delBtn.MouseUpEventHandler += (sender, e) =>
                    {
                        X = Application.GetRealWidth(16),
                        Width = Application.GetRealWidth(150),
                        Height = Application.GetRealHeight(20),
                        Text = control.name,
                        TextAlignment = TextAlignment.CenterLeft,
                        TextSize = TextSize.text14,
                        TextColor = CSS.CSS_Color.textColor,
                        Gravity = Gravity.CenterVertical,
                        var Function = controlView.delBtn.Tag as Entity.Function;
                        string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?";
                        TipPopView tipPopView = new TipPopView();
                        tipPopView.TipBox(StringId.tip, text, (dialog) =>
                        {
                            Thread(dialog, (responsePackNew) =>
                            {
                                dialog.Close();
                                var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid);
                                if (function != null)
                                {
                                    pirDevice.FunctioList.Remove(Function);
                                    if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid)
                                    {
                                        Pir.currPir.FunctioList = pirDevice.FunctioList;
                                    }
                                }
                                UIView(vv);
                            }, "删除", Function.deviceId, "");
                        }, () => { }, false);
                    };
                    funControlRow.AddChidren(nameBtn);
                    //遥控器区域
                    Button areaBtn = new Button
                    {
                        X = Application.GetRealWidth(311 + 16 - (40 + 100)),
                        Width = Application.GetRealWidth(100),
                        Height = Application.GetRealHeight(17),
                        Text = j.ToString(),
                        TextAlignment = TextAlignment.CenterRight,
                        TextSize = TextSize.text12,
                        TextColor = CSS.CSS_Color.textCancelColor,
                        Gravity = Gravity.CenterVertical,
                    };
                    funControlRow.AddChidren(areaBtn);
                    //下一级图标
                    Button nextIconBtn = new Button
                    {
                        X = Application.GetRealWidth(295 + 16),
                        Width = Application.GetRealWidth(16),
                        Height = Application.GetRealWidth(16),
                        UnSelectedImagePath = "PirIcon/next.png",
                        Gravity = Gravity.CenterVertical,
                    };
                    funControlRow.AddChidren(nextIconBtn);
                    //删除
                    Button delBtn = new Button
                    {
                        Width = Application.GetRealWidth(50),
                        Height = Application.GetRealHeight(22),
                        TextID = StringId.Del,
                        TextAlignment = TextAlignment.Center,
                        TextSize = TextSize.text16,
                        TextColor = CSS.CSS_Color.textWhiteColor,
                        IsBold = true,
                        BackgroundColor = CSS.CSS_Color.textRedColor,
                        Tag = control,
                    };
                    funControlRow.AddRightView(delBtn);
                    //线
                    Button line1Btn = new Button
                    {
                        Y = Application.GetRealHeight(50 - 2),
                        X = Application.GetRealWidth(16),
                        Width = Application.GetRealWidth(311),
                        Height = 1,
                        BackgroundColor = CSS.CSS_Color.viewLine,
                    };
                    funControlRow.AddChidren(line1Btn);
                    //view点击事件
                    controlView.clickBtn.MouseUpEventHandler += (sender, e) =>
                     {
                         EditControl editControl = new EditControl();
                         MainPage.BasePageView.AddChidren(editControl);
                         editControl.Show(control, pirDevice, (device) =>
                         {
                             //回调更新名字/区域
                             controlView.nameBtn.Text = device.name;
                             controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device);
                         });
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     };
                    if (j == pirDevice.FunctioList.Count - 1)
                    {
                        //最后改变一个线的颜色
                        line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                        funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
                        controlView.line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                        controlView.funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
                    }
                    delBtn.MouseUpEventHandler += (sender, e) =>
                    {
                        var Function = delBtn.Tag as Entity.Function;
                        //加载log
                        Loading loading = new Loading();
                        this.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        {
                            try
                            {
                                responsePackNew = PirSend.DeleteDevice(Function.deviceId);
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    loading.Hide();
                                    try
                                    {
                                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                        {
                                            pirDevice.FunctioList.Remove(Function);
                                            UIView(vv);
                                        }
                                        else
                                        {
                                            Method method = new Method();
                                            method.ErrorShow(responsePackNew);
                                        }
                                    }
                                    catch { }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                    };
                }
            }
        }
@@ -346,44 +181,15 @@
                    {
                        list.Add(Pir.pirDeviceList[b].name);
                    }
                    TipPopView tipPopView = new TipPopView();
                    tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) =>
                    Method methodView = new Method();
                    methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) =>
                    {
                        pirclick.name = name;
                        //加载log
                        Loading loading = new Loading();
                        view.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        Thread(view, (responsePackNew) =>
                        {
                            try
                            {
                                responsePackNew = PirSend.DeviceRename(pirclick);
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    loading.Hide();
                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                    {
                                        view.Close();
                                        UIView(vv);
                                    }
                                    else
                                    {
                                        Method method = new Method();
                                        method.ErrorShow(responsePackNew);
                                    }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                            pirclick.name = name;
                            view.Close();
                            UIView(vv);
                        }, "修改名称", pirclick.deviceId, pirclick.name);
                    }, () =>
                    {
                        NewSwitchView(pirclick, vv);
@@ -396,40 +202,12 @@
                    TipPopView tipPopView = new TipPopView();
                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
                    {
                        //加载log
                        Loading loading = new Loading();
                        dialog.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        Thread(dialog, (responsePackNew) =>
                        {
                            try
                            {
                                responsePackNew = PirSend.DeleteDevice(pirclick.deviceId);
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    loading.Hide();
                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                    {
                                        dialog.Close();
                                        UIView(vv);
                                    }
                                    else
                                    {
                                        Method method = new Method();
                                        method.ErrorShow(responsePackNew);
                                    }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                            dialog.Close();
                            UIView(vv);
                        }, "删除", pirclick.deviceId, "");
                    }, () =>
                    {
                        NewSwitchView(pirclick, vv);
@@ -438,7 +216,56 @@
                }
            });
        }
        /// <summary>
        /// 发送线程
        /// </summary>
        /// <param name="dialog"></param>
        /// <param name="action"></param>
        /// <param name="str"></param>
        /// <param name="deviceId"></param>
        /// <param name="obj"></param>
        void Thread(Dialog dialog, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, string deviceId, string obj)
        {
            //加载log
            Loading loading = new Loading();
            dialog.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    if (str == "删除")
                    {
                        responsePackNew = PirSend.DeleteDevice(deviceId);
                    }
                    else if (str == "修改名称")
                    {
                        responsePackNew = PirSend.DeviceRename(deviceId, obj);
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            action(responsePackNew);
                        }
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew);
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
New file
@@ -0,0 +1,110 @@
using System;
using Shared;
using System.Collections.Generic;
using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    public class EditControl : FrameLayout
    {
        public EditControl()
        {
        }
        public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action)
        {
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
            topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                action(control);
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.bianjixinxi;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(375),
                Height = Application.GetRealHeight(667 - 64),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            FrameLayout50 editNameFLayout = new FrameLayout50();
            editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
            editNameFLayout.btnEditText.Text = control.name;
            editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28);
            editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
            editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
            viewLayout.AddChidren(editNameFLayout.FLayoutView());
            FrameLayout50 areaFLayout = new FrameLayout50();
            areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu);
            areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
            areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
            viewLayout.AddChidren(areaFLayout.FLayoutView());
            editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                List<string> list = new List<string>();
                for (int i = 0; i < pir.FunctioList.Count; i++)
                {
                    list.Add(pir.FunctioList[i].name);
                }
                Method method = new Method();
                method.EditControlName(StringId.editName,list, control.name, (name,view) =>
                {
                    //加载log
                    Loading loading = new Loading();
                    view.AddChidren(loading);
                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                    loading.Start();
                    new System.Threading.Thread(() =>
                    {
                        try
                        {
                            responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                {
                                    view.Close();
                                    editNameFLayout.btnEditText.Text = name;
                                    control.name = name;
                                }
                                else
                                {
                                    Method methodError = new Method();
                                    methodError.ErrorShow(responsePackNew);
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                },()=> { });
            };
            areaFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                Method method = new Method();
                method.ManagementPosition(control, () =>
                {
                    //更新区域
                    areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
                });
            };
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -140,10 +140,12 @@
            fLayout.AddChidren(succeedBtn);
            #endregion
            #region 点击事件
            //表示库列表索引值
            int index= 1;
            //表示测试码索引值
            //表示库列表索引值(目前只20个库)
            int index = 1;
            //表示测试码索引值(目前只测试3个码)
            int code = 1;
            //表示测试最后一个码;
            bool if_bool = false;
            //左
            leftIconBtn.MouseUpEventHandler += (sender, e) =>
            {
@@ -165,22 +167,31 @@
                code = 1;
                GetBtnText(testBtn, code, spk);
            };
            //测试Text
            testBtn.MouseUpEventHandler += (sender, e) =>
            {
                var library = libraryList[index];
                var control = GetControl(spk, testBtn.TextID, library);
                //发送测试码命令
                CodeTest(control);
                if (code == 3) {
                    //标记最后那个码
                    if_bool = true;
                }
            };
            //控制失败
            failedBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (index < 20)
                {
                    //先加
                    index++;
                    //更新文本
                    sumBtn.Text = "(" + index.ToString() + "/20)";
                }
                code = 1;
                //更新状态
                GetBtnText(testBtn, code, spk);
            };
            //控制成功
@@ -190,17 +201,20 @@
                {
                    code++;
                }
                //更新状态
                GetBtnText(testBtn, code, spk);
                if (code == 3)
                if (if_bool)
                {
                    var library = libraryList[index];
                    var control = GetControl(spk, testBtn.TextID, library);
                    Method method = new Method();
                    method.ThreadAddControl(control, this,(control1) => {
                    //发送库添加遥控器命令
                    method.ThreadAddControl(control, this, (cont) =>
                    {
                        MainPage.BasePageView.RemoveViewByTag("PirView");
                        AddControlComplete addControlComplete = new AddControlComplete();
                        MainPage.BasePageView.AddChidren(addControlComplete);
                        addControlComplete.Show(control1,true);
                        addControlComplete.Show(cont, true);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    });
@@ -222,11 +236,11 @@
            string value = "";
            switch (spk)
            {
                case SPK.AcStandard:
                case SPK.AcIr:
                    {
                        switch (textInt)
                        {
                            case StringId.dianshi:
                            case StringId.dianyuan:
                                {
                                    key = "on_off";
                                    value = "on";
@@ -247,11 +261,11 @@
                        }
                    }
                    break;
                case SPK.ElectricTV:
                case SPK.TvIr:
                    {
                        switch (textInt)
                        {
                            case StringId.dianshi:
                            case StringId.dianyuan:
                                {
                                    key = "on_off";
                                    value = "on";
@@ -259,8 +273,8 @@
                                break;
                            case StringId.yinliangjia:
                                {
                                    key = "on_off";
                                    value = "on";
                                    key = "volume+";
                                    value = "50";
                                }
                                break;
                            case StringId.jingyin:
@@ -273,21 +287,23 @@
                    }
                    break;
            }
            ButtonObj buttonObj = new ButtonObj();
            buttonObj.Key = key;
            AttributesStatus buttonObj = new AttributesStatus();
            buttonObj.key = key;
            buttonObj.value = value;
            Control control = new Control();
            control.spk = spk;
            control.name = spk;
            control.group_id = library.irIndex;
            control.groupId = library.irIndex;
            control.type = "library";
            control.status.Add(buttonObj);
            control.deviceId = Pir.currPir.deviceId;
            control.sid = "";
            string[] strings = library.irCode.Split(',');
            for (int array = 0; array < strings.Length; array++)
            for (int arrayStr = 0; arrayStr < strings.Length; arrayStr++)
            {
                //var intValue = Convert.ToInt32(strings[array],16);
                control.library.Add(strings[array]);
                //var intValue = Convert.ToInt32(strings[arrayStr],16);
                control.library.Add(strings[arrayStr].Replace("0x",""));
            }
            return control;
@@ -309,7 +325,6 @@
            {
                try
                {
                    //发送按键删除;
                    responsePackNew = PirSend.CodeTest(control);
                }
                catch { }
@@ -324,8 +339,8 @@
                        }
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew);
                            //Method method = new Method();
                            //method.ErrorShow(responsePackNew);
                        }
                    });
@@ -368,7 +383,7 @@
                        }
                    }
                    break;
                case SPK.ElectricTV:
                case SPK.TvIr:
                    {
                        switch (code)
                        {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,17 +8,45 @@
{
    public class Method
    {
        /// <summary>
        /// 管理位置
        /// </summary>
        /// <param name="control">当前设备</param>
        /// <param name="action">回调函数</param>
        public void ManagementPosition(Entity.Function control, Action action)
        {
            var view = new ChooseRoomPage(control, action);
            MainPage.BasePageView.AddChidren(view);
            view.LoadPage();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
        /// <summary>
        /// 修改名称
        /// </summary>
        /// <param name="tipText">提示标题文本</param>
        /// <param name="list">当前存在名称列表</param>
        /// <param name="currName">当前名称</param>
        /// <param name="action">回调函数</param>
        public void EditControlName(int tipText, List<string> list, string currName, Action<string, Dialog> action, Action actionCancel, bool tag = false)
        {
            new View.TipView().InputBox(tipText, currName, StringId.nameNull, StringId.NameAlreadyExists, list, (text, view
                ) =>
            {
                action(text, view);
            }, () => { actionCancel(); }, tag);
        }
        /// <summary>
        /// 添加遥控器的方法
        /// </summary>
        /// <param name="frameLayout">log图标加载界面</param>
        /// <param name="action">回调函数</param>
        public void AddControl(FrameLayout frameLayout, Action<Control> action)
        {
            View.TipView tipView = new View.TipView();
            tipView.InputBox(frameLayout, "", (name, frame) =>
             {
                 ///清除之前列表数据
                 Pir.BuottonList.Clear();
                 if (!string.IsNullOrEmpty(name))
                 if (Pir.currPir != null && Pir.currPir.FunctioList.Count < 10)
                 {
                     Control control = new Control();
                     control.name = name;
@@ -26,9 +54,11 @@
                     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);
@@ -36,12 +66,12 @@
        /// <summary>
        /// 发送遥控器命令方法
        /// </summary>
        /// <param name="control"></param>
        /// <param name="frame"></param>
        /// <param name="control">发送参数对象</param>
        /// <param name="frame">log图标加载界面</param>
        /// <param name="action">回调函数</param>
        public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action)
        {
            DAL.Server.ResponsePackNew responsePackNew = null;
            Cloud mqttdate = null;
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
@@ -49,7 +79,18 @@
            {
                try
                {
                    responsePackNew = PirSend.Add(control);
                    //发送添加命令
                    var responsePackNew = PirSend.Add(control);
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        string sid = responsePackNew.Data.ToString();
                        mqttdate = MqttDate(sid);
                        if (mqttdate != null)
                        {
                            control.sid = sid;
                        }
                    }
                }
                catch { }
                finally
@@ -57,52 +98,58 @@
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        ///这里:监听MTTP推送下来主题;
                        if (mqttdate != null)
                        {
                            bool bool_if = false;
                            string sid = responsePackNew.Data.ToString();
                            var mqttdate = MqttDate();
                            for (int i = 0; i < mqttdate.objects.Count; i++) {
                                var objects = mqttdate.objects[i];
                                if (sid == objects.sid) {
                                    bool_if = true;
                                    break;
                                }
                            }
                            if (bool_if)
                            //休眠500毫秒,为等待云端创建deviceid;
                            System.Threading.Thread.Sleep(500);
                            //读取添加遥控器deviceID,才知道是否添加成功;
                            GetControl(frame, control, (device) =>
                            {
                                control.deviceId = mqttdate.id;
                                ///这里:监听MTTP推送下来主题,才知道是否添加成功
                                frame.RemoveFromParent();//添加成功关闭弹窗
                                action(control);
                            }
                            else
                            {
                                //监听Mqtt推送下来状态码做提示
                                View.FailView failView = new View.FailView();
                                failView.ShouError((view) =>
                                if (device != null)
                                {
                                    view.Close();
                                    ThreadAddControl(control, frame, action);
                                });
                            }
                                    control.deviceId = device.deviceId;
                                    frame.RemoveFromParent();//添加成功关闭弹窗
                                    action(control);
                                }
                                else
                                {
                                    //监听Mqtt推送下来状态码做提示
                                    View.FailView failView = new View.FailView();
                                    failView.ShouError((view) =>
                                    {
                                        view.Close();
                                        ThreadAddControl(control, frame, action);
                                    });
                                }
                            });
                        }
                        else
                        {
                            ErrorShow(responsePackNew);
                            //监听Mqtt推送下来状态码做提示
                            View.FailView failView = new View.FailView();
                            failView.ShouError((view) =>
                            {
                                view.Close();
                                ThreadAddControl(control, frame, action);
                            });
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 获取红外设备列表
        /// </summary>
        /// <param name="frame">log图标加载界面</param>
        /// <param name="action">回调函数</param>
        public static void GetPirDeviceList(FrameLayout frame, Action action)
        {
            //清除之前列表;
@@ -110,56 +157,63 @@
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    responsePackNew = PirSend.GetDeviceList("ir.module");
                    var responsePackNew = PirSend.GetDeviceList("ir.module");
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString());
                        string list = jobject["list"].ToString();
                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(list);
                        for (int a = 0; a < jArray.Count; a++)
                        {
                            var jay = jArray[a];
                            string spk = jay["spk"].ToString();
                            if (spk == "ir.module")
                            {
                                //数据返序列化为Logic对象
                                var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                if (pirJosn != null)
                                {
                                    if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                    {
                                        Pir.pirDeviceList.Add(pirJosn);
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        try
                        {
                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                            if (Pir.pirDeviceList.Count != 0)
                            {
                                var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString());
                                string list = jobject["list"].ToString();
                                var jArray = Newtonsoft.Json.Linq.JArray.Parse(list);
                                for (int a = 0; a < jArray.Count; a++)
                                GetControlList(() =>
                                {
                                    var jay = jArray[a];
                                    string spk = jay["spk"].ToString();
                                    if (spk == "ir.module")
                                    {
                                        //数据返序列化为Logic对象
                                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                        var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                        if (pirJosn != null)
                                        {
                                            if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                            {
                                    loading.Hide();
                                    action();
                                                Pir.pirDeviceList.Add(pirJosn);
                                            }
                                        }
                                    }
                                }
                                GetControlList(frame, action);
                                });
                            }
                            else
                            {
                                loading.Hide();
                                Method method = new Method();
                                method.ErrorShow(responsePackNew);
                                method.ErrorShow(null,"读取红外宝列表失败");
                            }
                        }
                        catch { }
@@ -174,13 +228,10 @@
        /// <summary>
        /// 获取遥控器列表
        /// </summary>
        public static void GetControlList(FrameLayout frame, Action action)
        /// <param name="action">回调函数</param>
        public static void GetControlList(Action action)
        {
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
@@ -190,45 +241,69 @@
                        var pirDevice = Pir.pirDeviceList[i];
                        try
                        {
                            responsePackNew = PirSend.ControlList(pirDevice);
                            var responsePackNew = PirSend.ControlList(pirDevice);
                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                            {
                                var jArray = JArray.Parse(responsePackNew.Data.ToString());
                                for (int a = 0; a < jArray.Count; a++)
                                {
                                    var jay = jArray[a];
                                    //数据返序列化为Logic对象
                                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                    var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                                    if (pirJosn != null)
                                    {
                                        if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
                                        {
                                            pirDevice.FunctioList.Add(pirJosn);
                                        }
                                    }
                                }
                            }
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                try
                                {
                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                    {
                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
                                        for (int a = 0; a < jArray.Count; a++)
                                        {
                                            var jay = jArray[a];
                                            //数据返序列化为Logic对象
                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                            var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                                            if (pirJosn != null)
                                            {
                                                if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
                                                {
                                                    pirDevice.FunctioList.Add(pirJosn);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        //Method method = new Method();
                                        //method.ErrorShow(responsePackNew);
                                    }
                                }
                                catch { }
                    }
                }
                catch { }
                finally
                {
                            });
                        }
                    Application.RunOnMainThread(() =>
                    {
                        action();
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 获取设备详情通过(spk,sid)
        /// </summary>
        /// <param name="frame">log图标加载界面</param>
        /// <param name="control">发送参数对象</param>
        /// <param name="action">回调函数</param>
        public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action)
        {
            Entity.Function function = null;
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    // 获取设备详情通过(spk,sid)
                    var responsePackNew = PirSend.GetinfoBySid(control);
                    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>(responsePackNew.Data.ToString());
                    }
                }
                catch { }
@@ -237,65 +312,112 @@
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        action();
                        action(function);
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 发送命令线程
        /// </summary>
        /// <param name="control">发送数据对象</param>
        /// <param name="action">回调函数</param>
        /// <param name="str">判断字符</param>
        /// <param name="frame">log父控件</param>
        /// <param name="dialog">log父控件</param>
        public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog)
        {
        }
        /// <summary>
        /// MQTT主题推送下来的数据(遥控器添加)
        /// MQTT主题推送下来的数据
        /// </summary>
        public static string addcontronsid = "";
        public static string mqttdata = "";
        /// <summary>
        ///
        /// 判断这个主题是否是添加遥控器主题
        /// </summary>
        /// <param name="sid">唯一标识</param>
        /// <param name="timeValue">等待时间值</param>
        /// <returns></returns>
        public Cloud MqttDate()
        public Cloud MqttDate(string sid, int timeValue = 10)
        {
            Cloud cloud = null;
            var dateTime = DateTime.Now;
            while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000)
            while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000)
            {
                if (!string.IsNullOrEmpty(addcontronsid))
                if (!string.IsNullOrEmpty(mqttdata))
                {
                    break;
                    try
                    {
                        var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(mqttdata);
                        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)
                        {
                            break;
                        }
                    }
                    catch { }
                }
            }
            return PushData();
        }
        public Cloud PushData()
        {
            Cloud cloud = new Cloud();
            if (addcontronsid != "")
            {
                //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid);
                cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid);
            }
            return cloud;
        }
        /// <summary>
        /// 错误码提示
        /// </summary>
        /// <param name="responsePackNew"></param>
        public void ErrorShow(ResponsePackNew responsePackNew)
        /// <param name="str"></param>
        public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "")
        {
            if (responsePackNew != null && responsePackNew.Code == "14005")
            if (str == "删除遥控器")
            {
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
            } else if (str == "读取红外宝列表失败") {
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox("读取红外宝列表失败");
            }
            else
            {
                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                if (responsePackNew != null)
                {
                    switch (responsePackNew.Code)
                    {
                        case "14005":
                            {
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
                            }
                            break;
                        case "10807":
                            {
                                //红外宝下遥控器超过最大(10个)数量限制
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox("红外宝下遥控器超过最大(10个)数量限制");
                            }
                            break;
                        default:
                            {
                                new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                            }
                            break;
                    }
                }
            }
        }
@@ -304,10 +426,7 @@
    [Serializable]
    public class Cloud
    {
        /// <summary>
        /// 设备id
        /// </summary>
        public string id = string.Empty;
        public string id = "";
        public List<Objects> objects = new List<Objects>();
        public string time_stamp = string.Empty;
@@ -316,8 +435,17 @@
    [Serializable]
    public class Objects
    {
        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
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    [System.Serializable]
    public class Pir: Entity.Function
    public class Pir : Entity.Function
    {
        /// <summary>
        /// 添加按键列表
        /// 红外宝列表
        /// </summary>
        public static List<ButtonObj> BuottonList = new List<ButtonObj>();
        public static List<Pir> pirDeviceList = new List<Pir>();
        /// <summary>
        /// 当前逻辑
@@ -20,7 +21,6 @@
        public List<Entity.Function> FunctioList = new List<Entity.Function>();
    }
    [System.Serializable]
    public class Control
@@ -28,11 +28,15 @@
        /// <summary>
        /// 红外宝设备Id
        /// </summary>
        public string deviceId = "0";
        public string deviceId = "";
        /// <summary>
        /// sid
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 红外遥控器名称
        /// </summary>
        public string name = "0";
        public string name = "";
        /// <summary>
        /// 红外遥控器spk
        /// </summary>
@@ -44,25 +48,17 @@
        /// <summary>
        /// 码组号
        /// </summary>
        public string group_id = "12";
        public string groupId = "";
        /// <summary>
        /// 红外码
        /// 红外码库
        /// </summary>
        public List<string> library = new List<string>();
        /// <summary>
        /// 红外码
        ///
        /// </summary>
        public List<ButtonObj> status = new List<ButtonObj>();
        public List<AttributesStatus> status = new List<AttributesStatus>();
    }
    [System.Serializable]
    public class ButtonObj
    {
        public string Key = string.Empty;
        /// <summary>
        /// #app 显示的文字
        /// </summary>
        public string value = string.Empty;
    }
    [System.Serializable]
    public class DeviceType
    {
@@ -92,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
@@ -5,6 +5,7 @@
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Shared;
using HDL_ON.Entity;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
@@ -12,7 +13,6 @@
    public class PirSend
    {
        public static string pirId = "1367032976869658625";
        /// <summary>
        /// 住宅ID
        /// </summary>
@@ -51,6 +51,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)
@@ -75,7 +88,7 @@
            jObject.Add("type", control.type);
            if (control.type=="library")
            {
                jObject.Add("group_id", control.group_id);
                jObject.Add("groupId", control.groupId);
                var libraryjay = new JArray { };
                for (int i = 0; i < control.library.Count; i++)
                {
@@ -97,8 +110,8 @@
            jObject.Add("homeId", HomeId);
            jObject.Add("deviceId", control.deviceId);
            jObject.Add("spk", control.spk);
            if (control.spk== Entity.SPK.AcStandard) {
                jObject.Add("group_id", control.group_id);
            if (control.spk== SPK.AcIr) {
                jObject.Add("groupId", control.groupId);
            }
            var libraryJay = new JArray { }; 
            for (int i = 0; i < control.library.Count; i++)
@@ -110,7 +123,7 @@
            {
                var statusJob = new JObject { };
                var job = control.status[i];
                statusJob.Add("key", job.Key);
                statusJob.Add("key", job.key);
                statusJob.Add("value", job.value);
                statusJay.Add(statusJob);
            }
@@ -124,7 +137,7 @@
        /// 红外码学习
        /// </summary>
        /// <returns></returns>
        public static void CodeStudy(ButtonObj buttonObj, Action<ResponsePackNew> action)
        public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action)
        {
            //var whichDayJson = jay["whichDay"].ToString();
            //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson);
@@ -134,14 +147,14 @@
            //    timer.whichDay.Add(int.Parse(days));
            //}
            var job = new JObject { };
            job.Add("key", buttonObj.Key);
            job.Add("key", buttonObj.key);
            job.Add("data_type", "string");
            var valuejArray = new JArray { };
            valuejArray.Add(buttonObj.value);
            job.Add("value", valuejArray);
            var jArray = new JArray { };
            jArray.Add(job);
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } };
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } };
            ResponsePackNew responsePackNew = null;
            new System.Threading.Thread(() =>
            {
@@ -167,17 +180,17 @@
        /// 自学按键删除
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew CodeRemove(ButtonObj buttonObj)
        public static ResponsePackNew CodeRemove(AttributesStatus buttonObj,string deviceId)
        {
            var job = new JObject { };
            job.Add("key", buttonObj.Key);
            job.Add("key", buttonObj.key);
            job.Add("data_type", "string");
            var valuejArray = new JArray { };
            valuejArray.Add(buttonObj.value);
            job.Add("value", valuejArray);
            var jArray = new JArray { };
            jArray.Add(job);
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } };
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
            return responsePackNew;
        }
@@ -193,12 +206,12 @@
            return responsePackNew;
        }
        /// <summary>
        /// 修改红外宝名称
        /// 修改红外宝/设备名称
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew DeviceRename(Pir  pir)
        public static ResponsePackNew DeviceRename(string deviceId,string name)
        {
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } };
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "name", name} };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename);
            return responsePackNew;
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs
New file
@@ -0,0 +1,113 @@
using System;
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
{
    public class ControlView
    {
        /// <summary>
        /// 父控件
        /// </summary>
        public RowLayout funControlRow = new RowLayout
        {
            Width = Application.GetRealWidth(375 - 16 * 2),
            Height = Application.GetRealHeight(50),
            LineColor = CSS.CSS_Color.textWhiteColor,
            SubViewWidth = Application.GetRealWidth(68),
        };
        /// <summary>
        /// 遥控器名称
        /// </summary>
        public Button nameBtn = new Button
        {
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(150),
            Height = Application.GetRealHeight(20),
            //Text = control.name,
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textColor,
            Gravity = Gravity.CenterVertical,
        };
        /// <summary>
        /// 遥控器区域
        /// </summary>
        public Button areaBtn = new Button
        {
            X = Application.GetRealWidth(311 + 16 - (40 + 100)),
            Width = Application.GetRealWidth(100),
            Height = Application.GetRealHeight(17),
            //Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control),
            TextAlignment = TextAlignment.CenterRight,
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textCancelColor,
            Gravity = Gravity.CenterVertical,
        };
        /// <summary>
        /// 下一级图标
        /// </summary>
        public Button nextIconBtn = new Button
        {
            X = Application.GetRealWidth(295 + 16),
            Width = Application.GetRealWidth(16),
            Height = Application.GetRealWidth(16),
            UnSelectedImagePath = "PirIcon/next.png",
            Gravity = Gravity.CenterVertical,
        };
        /// <summary>
        /// 删除
        /// </summary>
        public Button delBtn = new Button
        {
            Width = Application.GetRealWidth(50),
            Height = Application.GetRealHeight(22),
            TextID = StringId.Del,
            TextAlignment = TextAlignment.Center,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textWhiteColor,
            IsBold = true,
            BackgroundColor = CSS.CSS_Color.textRedColor,
            //Tag = control,
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button line1Btn = new Button
        {
            Y = Application.GetRealHeight(50 - 2),
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(311),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        /// <summary>
        /// 点击事件
        /// </summary>
        public Button clickBtn = new Button
        {
            Width = Application.GetRealWidth(375 - 16 * 2),
            Height = Application.GetRealHeight(50),
        };
        /// <summary>
        /// view方法
        /// </summary>
        /// <param name="frame"></param>
        public void Show(FrameLayout frame, int i)
        {
            funControlRow.Y = Application.GetRealHeight(92 + (50 * i));
            frame.AddChidren(funControlRow);
            funControlRow.AddChidren(nameBtn);
            funControlRow.AddChidren(areaBtn);
            funControlRow.AddChidren(nextIconBtn);
            funControlRow.AddRightView(delBtn);
            funControlRow.AddChidren(line1Btn);
            funControlRow.AddChidren(clickBtn);
        }
    }
}
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/FrameLayout50.cs
New file
@@ -0,0 +1,91 @@
using System;
using HDL_ON.UI.Music;
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
{
    public class FrameLayout50
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(50),
            BackgroundColor = CSS.CSS_Color.view,
        };
        /// <summary>
        /// 文本描述
        /// </summary>
        public Button btnText = new Button
        {
            TextSize = TextSize.Text16,
            Width = Application.GetRealWidth(200),
            Height = Application.GetRealHeight(22),
            TextColor = CSS.CSS_Color.textColor,
            X = Application.GetRealWidth(16),
        };
        /// <summary>
        /// 编辑文本
        /// </summary>
        public Button btnEditText = new Button
        {
            Width = Application.GetRealWidth(357 - 52 - 200 - 16),
            Height = Application.GetRealHeight(20),
            TextSize = TextSize.Text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            X = Application.GetRealWidth(200 + 16),
            TextAlignment = TextAlignment.CenterRight,
        };
        /// <summary>
        /// 图标
        /// </summary>
        public Button btnNextIcon = new Button
        {
            Width = Application.GetRealWidth(16),
            Height = Application.GetRealWidth(16),
            UnSelectedImagePath = "LogicIcon/next.png",
            X = Application.GetRealWidth(339),
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Width = Application.GetRealWidth(375 - 32),
            X = Application.GetRealWidth(16),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(50),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            btnText.Gravity = Gravity.CenterVertical;
            btnText.TextAlignment = TextAlignment.CenterLeft;
            btnNextIcon.Gravity = Gravity.CenterVertical;
            btnEditText.Gravity = Gravity.CenterVertical;
            frameLayout.AddChidren(btnText);
            frameLayout.AddChidren(btnEditText);
            frameLayout.AddChidren(btnNextIcon);
            btnLine.Y = frameLayout.Height - 1;
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
New file
@@ -0,0 +1,174 @@
using System;
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
{
    public class PirView
    {
        /// <summary>
        /// 父控件
        /// </summary>
        public FrameLayout devfLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(375 - 16 * 2),
            // Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 图标
        /// </summary>
        public Button priequipmentBtn = new Button
        {
            Y = Application.GetRealHeight(16),
            X = Application.GetRealWidth(5),
            Width = Application.GetRealWidth(60),
            Height = Application.GetRealWidth(60),
            UnSelectedImagePath = "PirIcon/priequipment.png",
            TextAlignment = TextAlignment.Center,
        };
        /// <summary>
        /// 名称
        /// </summary>
        public Button deviceNameBtn = new Button
        {
            Y = Application.GetRealHeight(16),
            X = Application.GetRealWidth(72),
            Width = Application.GetRealWidth(120),
            Height = Application.GetRealHeight(20),
            //Text = pirDevice.name,
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textColor,
            IsBold = true,
        };
        /// <summary>
        /// 版本号
        /// </summary>
        public Button versionBtn = new Button
        {
            Y = Application.GetRealHeight(40),
            X = Application.GetRealWidth(72),
            Width = Application.GetRealWidth(120),
            Height = Application.GetRealHeight(17),
            Text = "版本号v1.3.5",
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textCancelColor,
        };
        /// <summary>
        /// 当前个数
        /// </summary>
        public Button geBtn = new Button
        {
            Y = Application.GetRealHeight(59),
            X = Application.GetRealWidth(72),
            Width = Application.GetRealWidth(120),
            Height = Application.GetRealHeight(17),
            //Text = pirDevice.FunctioList.Count.ToString(),
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textConfirmColor,
        };
        /// <summary>
        /// 总数
        /// </summary>
        public Button sumBtn = new Button
        {
            Y = Application.GetRealHeight(59),
            Width = Application.GetRealWidth(20),
            Height = Application.GetRealHeight(17),
            Text = "/10",
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textCancelColor,
        };
        /// <summary>
        /// 状态图标
        /// </summary>
        public Button stateIconBtn = new Button
        {
            Y = Application.GetRealHeight(23),
            X = Application.GetRealWidth(291),
            Width = Application.GetRealWidth(8),
            Height = Application.GetRealWidth(8),
            UnSelectedImagePath = "PirIcon/online.png",
            SelectedImagePath = "PirIcon/offline.png",
        };
        /// <summary>
        /// 红外宝状态(在线-离线)
        /// </summary>
        public Button stateTextBtn = new Button
        {
            Y = Application.GetRealHeight(18),
            X = Application.GetRealWidth(303),
            Width = Application.GetRealWidth(30),
            Height = Application.GetRealHeight(17),
            TextID = StringId.zaixianhwb,
            TextAlignment = TextAlignment.CenterLeft,
            TextSize = TextSize.text12,
            TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
            SelectedTextColor = CSS.CSS_Color.textRedColor,
            IsBold = true,
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button lineBtn = new Button
        {
            Y = Application.GetRealHeight(92) - 1,
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(343 - 16 * 2),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        /// <summary>
        /// 点击事件
        /// </summary>
        public Button clickBtn = new Button
        {
            Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(375 - 16 * 2),
            Height = Application.GetRealHeight(92),
            BackgroundColor = 0x00000000, //CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
            //Tag = Pir.pirDeviceList[i],
        };
        /// <summary>
        /// view方法
        /// </summary>
        /// <param name="i"></param>
        /// <param name="fLayout"></param>
        public void Show(int i, FrameLayout fLayout)
        {
            fLayout.AddChidren(devfLayout);
            devfLayout.Height = Application.GetRealHeight(92 + (50 * i));
            devfLayout.AddChidren(priequipmentBtn);
            devfLayout.AddChidren(deviceNameBtn);
            devfLayout.AddChidren(versionBtn);
            devfLayout.AddChidren(geBtn);
            geBtn.Width = geBtn.GetTextWidth();
            devfLayout.AddChidren(sumBtn);
            sumBtn.X = geBtn.Right;
            devfLayout.AddChidren(stateIconBtn);
            devfLayout.AddChidren(stateTextBtn);
            devfLayout.AddChidren(lineBtn);
            devfLayout.AddChidren(clickBtn);
        }
    }
}
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
@@ -15,6 +15,186 @@
        /// 小框圆角值
        /// </summary>
        public int radiusEditFrameLayout = 4;
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tnputEditTxet">显示文本</param>
        /// <param name="errorId_IsNullOrEmpty">输入框文本为空自定义提示错误文本</param>
        /// <param name="errorId_PresenceP">检索已存在名称自定义提示错误文本</param>
        /// <param name="confirmAction">回调函数</param>
        /// <param name="List">被检索列表</param>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string, Dialog> confirmAction, Action action, bool tag = true)
        {
            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(172),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(200),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.Text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(btnTitle);
            FrameLayout editBjView = new FrameLayout()
            {
                // Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                X = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.viewMiddle,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
            };
            whiteView.AddChidren(editBjView);
            EditText editText = new EditText()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(20),
                Text = tnputEditTxet,
                TextColor = CSS_Color.textColor,
                TextSize = TextSize.Text14,
                TextAlignment = TextAlignment.CenterLeft,
            };
            editBjView.AddChidren(editText);
            Button clearIconBtn = new Button
            {
                X = Application.GetRealWidth(194),
                Y = Application.GetRealHeight(8),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "MusicIcon/clear.png",
            };
            editBjView.AddChidren(clearIconBtn);
            clearIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                editText.Text = "";
            };
            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();
                action();
            };
            Button btnTip = new Button
            {
                Width = Application.GetRealWidth(0),
            };
            whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                string listNameText = editText.Text.Trim();
                if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText))
                {
                    string tipMsgString = "";
                    if (string.IsNullOrEmpty(editText.Text.Trim()))
                    {
                        tipMsgString = Language.StringByID(errorId_IsNullOrEmpty);
                    }
                    else
                    {
                        tipMsgString = Language.StringByID(errorId_PresenceP);
                    }
                    whiteView.Height = Application.GetRealHeight(183);
                    btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                    btnCancel.Y = btnLine.Bottom;
                    btnCancel.Gravity = Gravity.BottomLeft;
                    btnConfirm.Y = btnLine.Bottom;
                    btnConfirm.Gravity = Gravity.BottomRight;
                    btnTip.X = Application.GetRealWidth(24);
                    btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
                    btnTip.Width = Application.GetRealWidth(222);
                    btnTip.Height = Application.GetRealHeight(17);
                    btnTip.Text = tipMsgString;
                    btnTip.TextColor = CSS_Color.textRedColor;
                    btnTip.TextSize = TextSize.Text12;
                    btnTip.TextAlignment = TextAlignment.CenterLeft;
                    return;
                }
                confirmAction(editText.Text.Trim(), dialog);
                if (tag)
                {
                    dialog.Close();
                }
            };
        }
        /// <summary>
        /// 输入框
@@ -326,7 +506,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();
            };
        }
    }
}