Merge branch 'WJC' into temp-wxr
| | |
| | | 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=取消 |
| | | |
| | | 7000=新建自动化 |
| | | 7001=编辑自动化 |
| | |
| | | //------------------------------------------------------------------------------ |
| | | // <auto-generated> |
| | | // This code was generated by a tool. |
| | | // Runtime Version:4.0.30319.42000 |
| | | // |
| | | // Changes to this file may cause incorrect behavior and will be lost if |
| | | // the code is regenerated. |
| | |
| | | { |
| | | |
| | | |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | public partial class Resource |
| | | { |
| | | |
| | |
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_Android", "HDL-ON_Android\HDL-ON_Android.csproj", "{09712674-2A38-407B-B1E2-560B2C352F9A}"
|
| | | 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
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_iOS", "HDL-ON_iOS\HDL-ON_iOS.csproj", "{D998E133-F0DD-4760-BE3C-461632F54DA4}"
|
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}"
|
| | | EndProject
|
| | | Global
|
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
| | |
| | | {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.Build.0 = Debug|Any CPU
|
| | | {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.ActiveCfg = Release|Any CPU
|
| | | {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.Build.0 = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
| | | {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
|
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
| | |
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhone.Build.0 = Debug|iPhone
|
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.ActiveCfg = Release|iPhone
|
| | | {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.Build.0 = Release|iPhone
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
| | | {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
| | | {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
|
| | | EndGlobalSection
|
| | | EndGlobal
|
| | |
| | | public const int dianqi = 6058; |
| | | public const int tianjiashibai = 6059; |
| | | public const int chongshii = 6060; |
| | | public const int pipeiyaokongqi = 6061; |
| | | public const int dianjianniu = 6062; |
| | | public const int shifouyouxiangying = 6063; |
| | | public const int kongzhishibai = 6064; |
| | | public const int kongzhichenggong = 6065; |
| | | public const int kaiguankai = 6066; |
| | | public const int moshizhileng = 6067; |
| | | public const int fengsuzhongfeng = 6068; |
| | | public const int wendu26 = 6069; |
| | | public const int shanchushebei = 6070; |
| | | public const int xiugaimingzi = 6071; |
| | | public const int querenshanchu = 6072; |
| | | public const int quxiao = 6073; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //App订阅红外宝 / 网关遥控器添加成功通知 |
| | | var pirStatus = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | |
| | | Utlis.WriteLine("开始订阅!"); |
| | | var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterPush2, topicAlinkStatus }); |
| | | var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { |
| | | pirStatus, |
| | | topicFilterPush2, topicAlinkStatus }); |
| | | if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) |
| | | { |
| | | isSubscribeSuccess = true; |
| | |
| | | //新挤下线主题方案 收到挤下线主题 |
| | | ReceiveNotifySqueezeAsync(mMes); |
| | | } |
| | | //App订阅红外宝/网关遥控器添加成功通知 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | | //A网关设备状态-包含涂鸦设备 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send") |
| | | { |
| | |
| | | /// 河东获取萤石云子账号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 |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | |
| | | ///// <summary> |
| | |
| | | /// </summary> |
| | | public const string AcStandard = "ac.standard"; |
| | | /// <summary> |
| | | /// (红外空调) |
| | | /// </summary> |
| | | public const string AcIr= "ir.ac"; |
| | | /// <summary> |
| | | /// (地热) |
| | | /// </summary> |
| | | public const string FloorHeatStandard = "floorHeat.standard"; |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\AC\AcControlPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\Matching.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\" />
|
| | |
| | | LoadEvent_SwitchFunction(btnLightPower, item, functionView); |
| | | }; |
| | | functionPageTitleId = StringId.Lights; |
| | | |
| | | |
| | | #endregion |
| | | break; |
| | | case ShowFunction.AC: |
| | |
| | | btnName.TextID = StringId.SecurityMonitoring; |
| | | btnFunctionViewBg.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | #if __IOS__ |
| | | EZSDK.IOS.EZSDK.Go2EZvizMonitor(); |
| | | #else //安卓摄像头 |
| | | HDLCommon.Current.Go2EZvizMonitor(bodyView); |
| | | #endif |
| | | }; |
| | | break; |
| | | case ShowFunction.Sensor: |
| | |
| | | { |
| | | list.Add(logic.name); |
| | | } |
| | | new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => |
| | | new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view |
| | | ) => |
| | | { |
| | | Logic.currlogic.name = logicName; |
| | | Logic.currlogic.sid = LogicMethod.NewSid(); |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | }); |
| | | },()=> { }); |
| | | |
| | | } |
| | | else |
| | |
| | | ///<param name="stateVuale">之前的状态值</param> |
| | | /// <param name="action">返回回调</param> |
| | | /// <returns></returns> |
| | | public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action) |
| | | public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action,bool tag=true) |
| | | { |
| | | int i = 2; |
| | | frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); |
| | |
| | | btnOn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | action(btnOn.TextID); |
| | | frame.RemoveFromParent(); |
| | | if (tag) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | }; |
| | | //点击事件 |
| | | btnOff.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | action(btnOff.TextID); |
| | | frame.RemoveFromParent(); |
| | | if (tag) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | /// <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> confirmAction) |
| | | 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() |
| | | { |
| | |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | action(); |
| | | |
| | | }; |
| | | Button btnTip = new Button |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | confirmAction(editText.Text.Trim()); |
| | | dialog.Close(); |
| | | confirmAction(editText.Text.Trim(),dialog); |
| | | if (tag) { |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | /// <param name="tnputEditTxet">显示文本</param> |
| | | /// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction) |
| | | public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction,Action action) |
| | | { |
| | | Dialog dialog = new Dialog() |
| | | { |
| | |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | action(); |
| | | |
| | | }; |
| | | |
| | | Button btnTip = new Button |
| | |
| | | /// 确定提示框 |
| | | /// </summary> |
| | | /// <param name="titleId">标题文本</param> |
| | | /// <param name="tipTxet">自定义提示文本</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void TipBox(int titleId, string tipTxet, Action<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(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, |
| | | Text= 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) => |
| | | { |
| | | action(); |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | confirmAction(dialog); |
| | | if (tag) { |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 确定提示框 |
| | | /// </summary> |
| | | /// <param name="titleId">标题文本</param> |
| | | /// <param name="tipTxet">自定义提示文本(换行)</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void TipBox1(int titleId, int tipTxet, Action confirmAction) |
| | |
| | | list.Add(logic.name); |
| | | } |
| | | |
| | | new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => |
| | | new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view |
| | | ) => |
| | | { |
| | | btnAutomationName.Text = logicName; |
| | | Logic.currlogic.name = logicName; |
| | | |
| | | }); |
| | | },()=> { }); |
| | | }; |
| | | nameView.btnClick.MouseUpEventHandler += editClick; |
| | | btnAutomationName.MouseUpEventHandler += editClick; |
| | |
| | | #region ---添加功能区域 |
| | | residenceAddFunctionView = new FrameLayout() |
| | | { |
| | | //X = residenceAuxiliaryFunctionView.Right, |
| | | X = Application.GetRealWidth(28 - 24), |
| | | Y = residenceManageView.Bottom, |
| | | X = residenceMemberView.Right, |
| | | //X = Application.GetRealWidth(28 - 24), |
| | | Y = Application.GetRealHeight(68), |
| | | Width = Application.GetRealWidth(64 + 48), |
| | | Height = Application.GetRealWidth(64), |
| | | }; |
| | | //residenceInfoView.AddChidren(residenceAddFunctionView); |
| | | residenceInfoView.AddChidren(residenceAddFunctionView); |
| | | btnResidenceAddFunctionIcon = new Button |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | |
| | | // var page = new ThirdPartyBrandListPage(); |
| | | // MainPage.BasePageView.AddChidren(page); |
| | | // page.LoadPage(); |
| | | var page = new UI2.PersonalCenter.PirDevice.PirMain(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //获取列表 |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var page = new UI2.PersonalCenter.PirDevice.PirMain(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | }); |
| | | }; |
| | | btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler; |
| | | btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler; |
| | |
| | | //MainPage.BasePageView.RemoveViewByTag("Pir"); |
| | | AddControlComplete addControlComplete = new AddControlComplete(); |
| | | MainPage.BasePageView.AddChidren(addControlComplete); |
| | | addControlComplete.Show(control); |
| | | addControlComplete.Show(control,false); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | #endregion |
| | |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | | public class AddControlComplete:FrameLayout |
| | | public class AddControlComplete : FrameLayout |
| | | { |
| | | public AddControlComplete() |
| | | { |
| | | Tag = "Pir"; |
| | | } |
| | | public void Show(Control control) { |
| | | public void Show(Control control, bool bool_library) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y =Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64), |
| | | BackgroundColor = CSS.CSS_Color.textWhiteColor, |
| | | Height = Application.GetRealHeight(224), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | // |
| | | Button iconBtn = new Button |
| | | Button iconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(28), |
| | | X = Application.GetRealWidth(137), |
| | |
| | | //添加成功 |
| | | Button text1Btn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(375-32), |
| | | Width = Application.GetRealWidth(375 - 32), |
| | | Height = Application.GetRealHeight(22), |
| | | Y = Application.GetRealHeight(158), |
| | | X = Application.GetRealWidth(16), |
| | |
| | | fLayout.AddChidren(text2Btn); |
| | | //所属分类 |
| | | View.PatchView fenlei = new View.PatchView(); |
| | | fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8); |
| | | fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8); |
| | | this.AddChidren(fenlei.FLayoutView(false)); |
| | | fenlei.btnText1.TextID = StringId.suoshufenlei; |
| | | fenlei.btnText2.TextID = StringId.dianqi; |
| | |
| | | { |
| | | Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375-32), |
| | | Width = Application.GetRealWidth(375 - 32), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.jixutianjia, |
| | | TextSize = TextSize.text14, |
| | |
| | | #endregion |
| | | #region 界面点击事件 |
| | | //遥控器名称点击事件 |
| | | namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { }; |
| | | namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; |
| | | //所属区域点击事件 |
| | | quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; |
| | | //继续添加点击事件 |
| | | addBtn.MouseUpEventHandler += (sender, e) => { |
| | | Method method = new Method(); |
| | | method.AddControl(); |
| | | addBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (bool_library) |
| | | { |
| | | this.RemoveFromParent(); |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.AddControl(this, (control1) => { |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control1); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | }; |
| | | //完成点击事件 |
| | | saveView.btnClick.MouseUpEventHandler += (sender, e) => { |
| | | saveView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | MainPage.BasePageView.RemoveViewByTag("AddControl"); |
| | | MainPage.BasePageView.RemoveViewByTag("Pir"); |
| | | }; |
| | |
| | | /// |
| | | /// </summary> |
| | | /// <param name="list">表示该列表元素A-Z字母筛选显示出来</param> |
| | | /// <param name="list6">表示该列表元素显示在list前面(该列表元素不做A-Z字母筛选),没有可以为list6=null</param> |
| | | public void Show(List<string> list, List<string> list6) |
| | | public void Show(List<Brand>brandList,List<string> list,string spk) |
| | | { |
| | | //string text = "30"; |
| | | //byte[] bytes = new byte[text.Length / 2]; |
| | | //for (int i = 0, j = 0; i < bytes.Length; j += 2, i++) |
| | | //{ |
| | | // //把16进度转换成byte |
| | | // bytes[i] = Convert.ToByte(text.Substring(j, 2), 16); |
| | | //} |
| | | ////把byte数组转换成文字 |
| | | //string str = System.Text.Encoding.UTF8.GetString(bytes); |
| | | |
| | | var frameLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTop, |
| | |
| | | { |
| | | list = new List<string>(); |
| | | } |
| | | if (list6 == null) |
| | | { |
| | | list6 = new List<string>(); |
| | | } |
| | | var list1 = GetDateList(list); |
| | | list1.InsertRange(0, list6); |
| | | |
| | | var vv = new VerticalScrolViewLayout(); |
| | | fram.AddChidren(vv); |
| | |
| | | listStr.Add(s); |
| | | } |
| | | } |
| | | RefreshLayout(vv, listStr); |
| | | RefreshLayout(vv, brandList, listStr,spk); |
| | | |
| | | }; |
| | | #region A-Z |
| | |
| | | } |
| | | #endregion |
| | | |
| | | RefreshLayout(vv, list1); |
| | | RefreshLayout(vv, brandList, list1,spk); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="vv">父控件</param> |
| | | /// <param name="list">显示列表</param> |
| | | private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list) |
| | | private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list,string spk) |
| | | { |
| | | vv.RemoveAll(); |
| | | foreach (var str in list) |
| | |
| | | vv.AddChidren(rowLayout); |
| | | clickBtn.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | ////找到索引值 |
| | | //var index = list.IndexOf(clickBtn.Tag.ToString()); |
| | | |
| | | //this.RemoveFromParent(); |
| | | var name = clickBtn.Tag.ToString(); |
| | | var brandObj = brandList.Find((c) => c.brandName == name); |
| | | if (brandObj==null) { |
| | | return; |
| | | } |
| | | GetLibraryList(brandObj.id, (libraryList) => |
| | | { |
| | | Matching matching = new Matching(); |
| | | MainPage.BasePageView.AddChidren(matching); |
| | | matching.Show(libraryList, spk); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取品牌红外码库列表 |
| | | /// </summary> |
| | | private void GetLibraryList(string id, Action<List<Library>> actionBrand) |
| | | { |
| | | List<Library> libraryList = new List<Library>(); |
| | | PirSend.GetDeviceTypesList(this, (responsePackNew) => |
| | | { |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | //清空之前数据 |
| | | libraryList.Clear(); |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); |
| | | if (library != null) |
| | | { |
| | | if (libraryList.Count<20) |
| | | { |
| | | libraryList.Add(library); |
| | | } |
| | | } |
| | | } |
| | | actionBrand(libraryList); |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | }, id, "品牌红外码库列表"); |
| | | } |
| | | /// <summary> |
| | | /// 列表是否包含该值(true=包含,false=不包含) |
| | |
| | | else return ("ZZ"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | Tag = "PirView"; |
| | | } |
| | | public void Show() { |
| | | public void Show() |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | |
| | | topView.topIconBtn.Visible = true; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | vv.Height = Application.GetRealHeight(667 - 64); |
| | | vv.Y = Application.GetRealHeight(64); |
| | | this.AddChidren(vv); |
| | | #endregion |
| | | int a = 3; |
| | | int b = 3; |
| | | for (int i = 0; i < b; i++) |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | //获取列表 |
| | | Method.GetPirDeviceList(this,() => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //刷新界面 |
| | | UIView(vv); |
| | | }); |
| | | }); |
| | | |
| | | }; |
| | | #endregion |
| | | UIView(vv); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 加载UI界面 |
| | | /// </summary> |
| | | /// <param name="vv">上下滑控件</param> |
| | | void UIView(VerticalRefreshLayout vv) |
| | | { |
| | | vv.RemoveAll(); |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | #region 红外宝图标 版本号 名称 状态 |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(375), |
| | | Height = Application.GetRealHeight(12+92+(50* a)), |
| | | 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 * a)), |
| | | 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), |
| | | Y = Application.GetRealHeight(16), |
| | | X = Application.GetRealWidth(5), |
| | | Width = Application.GetRealWidth(60), |
| | | Height = Application.GetRealWidth(60), |
| | |
| | | //红外宝名称 |
| | | Button deviceNameBtn = new Button |
| | | { |
| | | Y=Application.GetRealHeight(16), |
| | | Y = Application.GetRealHeight(16), |
| | | X = priequipmentBtn.Right + Application.GetRealWidth(7), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = "红外宝A"+i.ToString(), |
| | | Text = pirDevice.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | |
| | | //版本号 |
| | | Button versionBtn = new Button |
| | | { |
| | | Y = deviceNameBtn.Bottom+ Application.GetRealHeight(4), |
| | | Y = deviceNameBtn.Bottom + Application.GetRealHeight(4), |
| | | X = priequipmentBtn.Right + Application.GetRealWidth(7), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(17), |
| | |
| | | X = priequipmentBtn.Right + Application.GetRealWidth(7), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "2", |
| | | Text = pirDevice.FunctioList.Count.ToString(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | |
| | | X = geBtn.Right, |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealHeight(17), |
| | | Text ="/10", |
| | | Text = "/10", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | |
| | | //状态图标 |
| | | Button stateIconBtn = new Button |
| | | { |
| | | Y =Application.GetRealHeight(23), |
| | | Y = Application.GetRealHeight(23), |
| | | X = Application.GetRealWidth(291), |
| | | Width = Application.GetRealWidth(8), |
| | | Height = Application.GetRealWidth(8), |
| | |
| | | X = Application.GetRealWidth(303), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(17), |
| | | TextID=StringId.zaixianhwb, |
| | | TextID = StringId.zaixianhwb, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text12, |
| | | TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, |
| | | IsBold=true, |
| | | IsBold = true, |
| | | }; |
| | | devfLayout.AddChidren(stateTextBtn); |
| | | //线 |
| | | Button lineBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(92)-1, |
| | | Y = Application.GetRealHeight(92) - 1, |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(343-16*2), |
| | | Height =1, |
| | | 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); |
| | | |
| | | if (b - 1 == i) |
| | | clickFram.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var pirclick = (clickFram.Tag as Pir); |
| | | NewSwitchView(pirclick, vv); |
| | | }; |
| | | |
| | | if (Pir.pirDeviceList.Count - 1 == i) |
| | | { |
| | | //最后一个后面增加间隔背景 |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); |
| | | } |
| | | #endregion |
| | | |
| | | for (int j = 0; j < a; j++) { |
| | | 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), |
| | | SubViewWidth = Application.GetRealWidth(68), |
| | | }; |
| | | devfLayout.AddChidren(funControlRow); |
| | | //遥控器名称 |
| | |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(20), |
| | | Text =j.ToString(), |
| | | TextAlignment=TextAlignment.CenterLeft, |
| | | Text = control.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | Gravity=Gravity.CenterVertical, |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | funControlRow.AddChidren(nameBtn); |
| | | //遥控器区域 |
| | | Button areaBtn = new Button |
| | | { |
| | | X=Application.GetRealWidth(311+16-(40+100)), |
| | | 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, |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | funControlRow.AddChidren(areaBtn); |
| | | //下一级图标 |
| | | Button nextIconBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(295+16), |
| | | X = Application.GetRealWidth(295 + 16), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "PirIcon/next.png", |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textWhiteColor, |
| | | IsBold=true, |
| | | BackgroundColor= CSS.CSS_Color.textRedColor, |
| | | IsBold = true, |
| | | BackgroundColor = CSS.CSS_Color.textRedColor, |
| | | Tag = control, |
| | | }; |
| | | funControlRow.AddRightView(delBtn); |
| | | //线 |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | }; |
| | | funControlRow.AddChidren(line1Btn); |
| | | if (j == a - 1) |
| | | if (j == pirDevice.FunctioList.Count - 1) |
| | | { |
| | | //最后改变一个线的颜色 |
| | | line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; |
| | | funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; |
| | | } |
| | | delBtn.MouseUpEventHandler += (sender,e) => { |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 加载弹框 |
| | | /// </summary> |
| | | /// <param name="pirclick"></param> |
| | | /// <param name="vv"></param> |
| | | void NewSwitchView(Pir pirclick, VerticalRefreshLayout vv) |
| | | { |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | SwitchView switchView = new SwitchView(); |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | switchView.FLayoutView(frame, StringId.shanchushebei, StringId.xiugaimingzi, "", (intValue) => |
| | | { |
| | | if (StringId.xiugaimingzi == intValue) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | for (int b = 0; b < Pir.pirDeviceList.Count; b++) |
| | | { |
| | | list.Add(Pir.pirDeviceList[b].name); |
| | | } |
| | | TipPopView tipPopView = new TipPopView(); |
| | | tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (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(() => |
| | | { |
| | | 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(); |
| | | |
| | | }, () => |
| | | { |
| | | NewSwitchView(pirclick, vv); |
| | | }, false); |
| | | |
| | | } |
| | | else |
| | | { |
| | | string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?"; |
| | | 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(() => |
| | | { |
| | | 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(); |
| | | }, () => |
| | | { |
| | | NewSwitchView(pirclick, vv); |
| | | }, false); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | | public class Matching : FrameLayout |
| | | { |
| | | public Matching() |
| | | { |
| | | Tag = "PirView"; |
| | | } |
| | | public void Show(List<Library> libraryList,string spk) |
| | | { |
| | | #region 界面布局 |
| | | 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 += (sender, e) => { this.RemoveFromParent(); }; |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y = topView.frameLayout.Bottom, |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | //请点击以下按钮 |
| | | Button text1Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(60), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 32), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.dianjianniu, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | |
| | | }; |
| | | fLayout.AddChidren(text1Btn); |
| | | |
| | | //确认设备是否有响应 |
| | | Button text2Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(60 + 24), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 32), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.shifouyouxiangying, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | fLayout.AddChidren(text2Btn); |
| | | //左 |
| | | var leftIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(203), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(36), |
| | | Height = Application.GetRealWidth(36), |
| | | UnSelectedImagePath = "PirIcon/left.png", |
| | | }; |
| | | fLayout.AddChidren(leftIconBtn); |
| | | //右 |
| | | var rightIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(203), |
| | | X = Application.GetRealWidth(323), |
| | | Width = Application.GetRealWidth(36), |
| | | Height = Application.GetRealWidth(36), |
| | | UnSelectedImagePath = "PirIcon/right.png", |
| | | }; |
| | | fLayout.AddChidren(rightIconBtn); |
| | | //测试功能 |
| | | var testBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(199), |
| | | X = Application.GetRealWidth(136), |
| | | Width = Application.GetRealWidth(104), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID=StringId.dianyuan, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderWidth = 1, |
| | | BorderColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | | fLayout.AddChidren(testBtn); |
| | | |
| | | // 5/10 |
| | | Button sumBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(267), |
| | | X = Application.GetRealWidth(170), |
| | | Width = Application.GetRealWidth(36), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "(1/20)", |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | | fLayout.AddChidren(sumBtn); |
| | | |
| | | //控制失败 |
| | | var failedBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(521), |
| | | X = Application.GetRealWidth(52), |
| | | Width = Application.GetRealWidth(124), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.kongzhishibai, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealHeight(44), |
| | | BorderWidth = 1, |
| | | BorderColor = CSS.CSS_Color.textConfirmColor, |
| | | }; |
| | | fLayout.AddChidren(failedBtn); |
| | | //控制成功 |
| | | var succeedBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(521), |
| | | X = Application.GetRealWidth(196), |
| | | Width = Application.GetRealWidth(124), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.kongzhichenggong, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textWhiteColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealHeight(44), |
| | | //BorderWidth = 1, |
| | | //BorderColor = CSS.CSS_Color.textConfirmColor, |
| | | BackgroundColor = CSS.CSS_Color.textConfirmColor, |
| | | }; |
| | | fLayout.AddChidren(succeedBtn); |
| | | #endregion |
| | | #region 点击事件 |
| | | //表示库列表索引值 |
| | | int index= 1; |
| | | //表示测试码索引值 |
| | | int code = 1; |
| | | //左 |
| | | leftIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (index>1) { |
| | | index--; |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | } |
| | | code = 1; |
| | | GetBtnText(testBtn, code, spk); |
| | | }; |
| | | //右 |
| | | rightIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (index < 20) |
| | | { |
| | | index++; |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | } |
| | | code = 1; |
| | | GetBtnText(testBtn, code, spk); |
| | | }; |
| | | //测试Text |
| | | testBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var library = libraryList[index]; |
| | | var control = GetControl(spk, testBtn.TextID, library); |
| | | CodeTest(control); |
| | | }; |
| | | //控制失败 |
| | | failedBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (index < 20) |
| | | { |
| | | index++; |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | } |
| | | code = 1; |
| | | GetBtnText(testBtn, code, spk); |
| | | }; |
| | | //控制成功 |
| | | succeedBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (code < 3) |
| | | { |
| | | code++; |
| | | } |
| | | GetBtnText(testBtn, code, spk); |
| | | if (code == 3) |
| | | { |
| | | var library = libraryList[index]; |
| | | var control = GetControl(spk, testBtn.TextID, library); |
| | | Method method = new Method(); |
| | | method.ThreadAddControl(control, this,(control1) => { |
| | | MainPage.BasePageView.RemoveViewByTag("PirView"); |
| | | AddControlComplete addControlComplete = new AddControlComplete(); |
| | | MainPage.BasePageView.AddChidren(addControlComplete); |
| | | addControlComplete.Show(control1,true); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | | } |
| | | }; |
| | | #endregion |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取Control对象(存储发送数据的对象) |
| | | /// </summary> |
| | | /// <param name="spk"></param> |
| | | /// <param name="textInt"></param> |
| | | /// <param name="library"></param> |
| | | /// <returns></returns> |
| | | private Control GetControl(string spk, int textInt, Library library) { |
| | | |
| | | string key = ""; |
| | | string value = ""; |
| | | switch (spk) |
| | | { |
| | | case SPK.AcStandard: |
| | | { |
| | | switch (textInt) |
| | | { |
| | | case StringId.dianshi: |
| | | { |
| | | key = "on_off"; |
| | | value = "on"; |
| | | } |
| | | break; |
| | | case StringId.moshizhileng: |
| | | { |
| | | key = "mode"; |
| | | value = "cool"; |
| | | } |
| | | break; |
| | | case StringId.fengsuzhongfeng: |
| | | { |
| | | key = "fan"; |
| | | value = "medium"; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.ElectricTV: |
| | | { |
| | | switch (textInt) |
| | | { |
| | | case StringId.dianshi: |
| | | { |
| | | key = "on_off"; |
| | | value = "on"; |
| | | } |
| | | break; |
| | | case StringId.yinliangjia: |
| | | { |
| | | key = "on_off"; |
| | | value = "on"; |
| | | } |
| | | break; |
| | | case StringId.jingyin: |
| | | { |
| | | key = "mute"; |
| | | value = "0"; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | ButtonObj buttonObj = new ButtonObj(); |
| | | buttonObj.Key = key; |
| | | buttonObj.value = value; |
| | | |
| | | Control control = new Control(); |
| | | control.spk = spk; |
| | | control.name = spk; |
| | | control.group_id = library.irIndex; |
| | | control.type = "library"; |
| | | control.status.Add(buttonObj); |
| | | string[] strings = library.irCode.Split(','); |
| | | for (int array = 0; array < strings.Length; array++) |
| | | { |
| | | //var intValue = Convert.ToInt32(strings[array],16); |
| | | control.library.Add(strings[array]); |
| | | } |
| | | |
| | | return control; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送库码测试命令 |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | private void CodeTest(Control control) |
| | | { |
| | | |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | //发送按键删除; |
| | | responsePackNew = PirSend.CodeTest(control); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示测试文本 |
| | | /// </summary> |
| | | /// <param name="testBtn">显示控件</param> |
| | | /// <param name="code">测试码文本索引值</param> |
| | | /// <param name="spk">云雀上定义spk</param> |
| | | private void GetBtnText(Button testBtn,int code,string spk) { |
| | | |
| | | int textValue = 0; |
| | | switch (spk) |
| | | { |
| | | case SPK.AcIr: |
| | | { |
| | | switch (code) |
| | | { |
| | | case 1: |
| | | { |
| | | textValue = StringId.dianyuan; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | textValue = StringId.moshizhileng; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | textValue = StringId.fengsuzhongfeng; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.ElectricTV: |
| | | { |
| | | switch (code) |
| | | { |
| | | case 1: |
| | | { |
| | | textValue = StringId.dianyuan; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | textValue = StringId.yinliangjia; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | textValue = StringId.jingyin; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | testBtn.TextID = textValue; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using HDL_ON.DAL.Server; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | |
| | | /// <summary> |
| | | /// 添加遥控器的方法 |
| | | /// </summary> |
| | | public void AddControl() |
| | | public void AddControl(FrameLayout frameLayout, Action<Control> action) |
| | | { |
| | | View.TipView tipView = new View.TipView(); |
| | | tipView.InputBox("", (s, dialog) => |
| | | { |
| | | ///清除之前列表数据 |
| | | Pir.BuottonList.Clear(); |
| | | if (!string.IsNullOrEmpty(s)) |
| | | { |
| | | Control control = new Control(); |
| | | control.name = s; |
| | | control.type = "learn"; |
| | | |
| | | ThreadAddControl(control,dialog); |
| | | tipView.InputBox(frameLayout, "", (name, frame) => |
| | | { |
| | | ///清除之前列表数据 |
| | | Pir.BuottonList.Clear(); |
| | | if (!string.IsNullOrEmpty(name)) |
| | | { |
| | | Control control = new Control(); |
| | | control.name = name; |
| | | control.type = "learn"; |
| | | control.spk = "ir.learn"; |
| | | control.deviceId = Pir.currPir.deviceId; |
| | | ThreadAddControl(control, frame, action); |
| | | |
| | | |
| | | |
| | | } |
| | | },false); |
| | | } |
| | | }, false); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 发送遥控器命令方法 |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | /// <param name="dialog"></param> |
| | | public void ThreadAddControl(Control control, Dialog dialog) { |
| | | /// <param name="frame"></param> |
| | | public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action) |
| | | { |
| | | |
| | | DAL.Server.ResponsePackNew responsePackNew = null; |
| | | Loading loading = new Loading(); |
| | | dialog.AddChidren(loading); |
| | | frame.AddChidren(loading); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | //{ |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | dialog.Close();//添加成功关闭弹窗 |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | 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) |
| | | { |
| | | control.deviceId = mqttdate.id; |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | action(control); |
| | | } |
| | | else |
| | | { |
| | | //监听Mqtt推送下来状态码做提示 |
| | | View.FailView failView = new View.FailView(); |
| | | failView.ShouError((view) => |
| | | { |
| | | view.Close(); |
| | | ThreadAddControl(control, frame, action); |
| | | }); |
| | | } |
| | | |
| | | //监听Mqtt推送下来状态码做提示 |
| | | //View.FailView failView = new View.FailView(); |
| | | //failView.ShouError((view) => { |
| | | // view.Close(); |
| | | // ThreadAddControl(control, dialog); |
| | | //}); |
| | | //} |
| | | //else |
| | | //{ |
| | | // ErrorShow(responsePackNew); |
| | | //} |
| | | |
| | | } |
| | | else |
| | | { |
| | | ErrorShow(responsePackNew); |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取红外设备列表 |
| | | /// </summary> |
| | | public static void GetPirDeviceList(FrameLayout frame, Action action) |
| | | { |
| | | //清除之前列表; |
| | | Pir.pirDeviceList.Clear(); |
| | | //加载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"); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | try |
| | | { |
| | | 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); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | GetControlList(frame, action); |
| | | |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static void GetControlList(FrameLayout frame, Action action) |
| | | { |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | frame.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | try |
| | | { |
| | | responsePackNew = PirSend.ControlList(pirDevice); |
| | | |
| | | } |
| | | 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(() => |
| | | { |
| | | loading.Hide(); |
| | | action(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// MQTT主题推送下来的数据(遥控器添加) |
| | | /// </summary> |
| | | public static string addcontronsid = ""; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Cloud MqttDate() |
| | | { |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000) |
| | | { |
| | | if (!string.IsNullOrEmpty(addcontronsid)) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | } |
| | | 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) |
| | | public void ErrorShow(ResponsePackNew responsePackNew) |
| | | { |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "14005") |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | [Serializable] |
| | | public class Cloud |
| | | { |
| | | /// <summary> |
| | | /// 设备id |
| | | /// </summary> |
| | | public string id = string.Empty; |
| | | public List<Objects> objects = new List<Objects>(); |
| | | public string time_stamp = string.Empty; |
| | | |
| | | |
| | | } |
| | | [Serializable] |
| | | public class Objects |
| | | { |
| | | public string sid = string.Empty; |
| | | public string spk = string.Empty; |
| | | } |
| | | |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | | public class Pir |
| | | [System.Serializable] |
| | | public class Pir: Entity.Function |
| | | { |
| | | /// <summary> |
| | | /// 添加按键列表 |
| | | /// </summary> |
| | | public static List<ButtonObj> BuottonList = new List<ButtonObj>(); |
| | | public static List<Pir> pirDeviceList = new List<Pir>(); |
| | | /// <summary> |
| | | /// 当前逻辑 |
| | | /// </summary> |
| | | public static Pir currPir; |
| | | /// <summary> |
| | | /// 遥控器列表 |
| | | /// </summary> |
| | | public List<Entity.Function> FunctioList = new List<Entity.Function>(); |
| | | |
| | | } |
| | | public class ButtonObj |
| | | { |
| | | public string Key = string.Empty; |
| | | /// <summary> |
| | | /// #app 显示的文字 |
| | | /// </summary> |
| | | public string value = string.Empty; |
| | | } |
| | | |
| | | |
| | | [System.Serializable] |
| | | public class Control |
| | | { |
| | | /// <summary> |
| | |
| | | /// 红外码 |
| | | /// </summary> |
| | | public List<string> library = new List<string>(); |
| | | /// <summary> |
| | | /// 红外码 |
| | | /// </summary> |
| | | public List<ButtonObj> status = new List<ButtonObj>(); |
| | | } |
| | | [System.Serializable] |
| | | public class ButtonObj |
| | | { |
| | | public string Key = string.Empty; |
| | | /// <summary> |
| | | /// #app 显示的文字 |
| | | /// </summary> |
| | | public string value = string.Empty; |
| | | } |
| | | [System.Serializable] |
| | | public class DeviceType |
| | | { |
| | | /// <summary> |
| | | /// 设备类型主键Id |
| | | /// </summary> |
| | | public string id = string.Empty; |
| | | /// <summary> |
| | | /// 设备类型(投影仪,风扇,机顶盒...) |
| | | /// </summary> |
| | | public string deviceType = string.Empty; |
| | | } |
| | | [System.Serializable] |
| | | public class Brand |
| | | { |
| | | /// <summary> |
| | | /// 品牌主键Id |
| | | /// </summary> |
| | | public string id = string.Empty; |
| | | /// <summary> |
| | | /// 设备类型主键Id |
| | | /// </summary> |
| | | public string deviceTypeId = string.Empty; |
| | | /// <summary> |
| | | /// 品牌名称 |
| | | /// </summary> |
| | | public string brandName = string.Empty; |
| | | |
| | | } |
| | | |
| | | public class Library |
| | | { |
| | | /// <summary> |
| | | /// 红外码 |
| | | /// </summary> |
| | | public string irCode = string.Empty; |
| | | /// <summary> |
| | | /// 品牌主键Id |
| | | /// </summary> |
| | | public string brandId = string.Empty; |
| | | /// <summary> |
| | | /// 红外码索引序号 |
| | | /// </summary> |
| | | public string irIndex = string.Empty; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | |
| | | { |
| | | public PirMain() |
| | | { |
| | | Tag = "PirView"; |
| | | Tag = "PirMain"; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 临时储存设备类型列表 |
| | | /// </summary> |
| | | List<DeviceType> DeviceTypeList = new List<DeviceType>(); |
| | | public void Show() |
| | | { |
| | | #region 界面布局 |
| | |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.shebeigaunli, |
| | | IsBold=true, |
| | | IsBold = true, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(text1Btn); |
| | | pirDeviceFLayout.AddChidren(text1Btn); |
| | | |
| | | |
| | | Button pirIcon = new Button |
| | |
| | | ///红外宝点击事件 |
| | | FrameLayout clickFLayout = new FrameLayout(); |
| | | pirDeviceFLayout.AddChidren(clickFLayout); |
| | | clickFLayout.MouseUpEventHandler += (sender,e) => { |
| | | clickFLayout.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | DeviceSet deviceSet = new DeviceSet(); |
| | | MainPage.BasePageView.AddChidren(deviceSet); |
| | |
| | | }; |
| | | deviceListFLayout.AddChidren(text3Btn); |
| | | ///红外宝名称 |
| | | Button deviceNameBtn= new Button |
| | | Button deviceNameBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(13), |
| | | X = Application.GetRealWidth(161), |
| | |
| | | Text = "mini智能遥控器", |
| | | }; |
| | | deviceListFLayout.AddChidren(deviceNameBtn); |
| | | if (Pir.pirDeviceList.Count != 0) |
| | | { |
| | | deviceNameBtn.Text = Pir.pirDeviceList[0].name; |
| | | Pir.currPir = Pir.pirDeviceList[0]; |
| | | } |
| | | |
| | | //下拉图标 |
| | | var dropdownIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(13), |
| | | X = Application.GetRealWidth(343-8-16), |
| | | X = Application.GetRealWidth(343 - 8 - 16), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "PirIcon/dropdown.png", |
| | | }; |
| | | deviceListFLayout.AddChidren(dropdownIconBtn); |
| | | |
| | | deviceNameBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | #region 区域弹框界面 |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | fLayout.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | FrameLayout iconFLyout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(205), |
| | | Y = Application.GetRealHeight(314), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(21 + 44), |
| | | //BackgroundImagePath = "LogicIcon/bjicon.png", |
| | | }; |
| | | fLayout.AddChidren(iconFLyout); |
| | | |
| | | FrameLayout textFLyout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44 * 4), |
| | | }; |
| | | |
| | | if (Pir.pirDeviceList.Count > 4) |
| | | { |
| | | iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4); |
| | | iconFLyout.AddChidren(vv); |
| | | iconFLyout.BackgroundImagePath = "PirIcon/4.png"; |
| | | } |
| | | else |
| | | { |
| | | |
| | | iconFLyout.AddChidren(textFLyout); |
| | | iconFLyout.Height = Application.GetRealHeight(21 + 44 * Pir.pirDeviceList.Count); |
| | | textFLyout.Height = Application.GetRealHeight(44 * Pir.pirDeviceList.Count); |
| | | iconFLyout.BackgroundImagePath = $"PirIcon/{Pir.pirDeviceList.Count}.png"; |
| | | } |
| | | #endregion |
| | | |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirJson = Pir.pirDeviceList[i]; |
| | | View.PirNameView pirNameView = new View.PirNameView(); |
| | | if (Pir.pirDeviceList.Count > 4) |
| | | { |
| | | vv.AddChidren(pirNameView.FLayoutView()); |
| | | } |
| | | else |
| | | { |
| | | pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44); |
| | | textFLyout.AddChidren(pirNameView.FLayoutView()); |
| | | } |
| | | pirNameView.btnName.Text = pirJson.name; |
| | | pirNameView.btnClick.Tag = pirJson; |
| | | pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | fLayout.RemoveFromParent(); |
| | | deviceNameBtn.Text = pirJson.name; |
| | | Pir.currPir = pirJson; |
| | | |
| | | }; |
| | | if (Pir.pirDeviceList.Count - 1 == i) |
| | | { |
| | | ///改变最后那条一个线的颜色,界面显示效果作用; |
| | | pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view; |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | #endregion |
| | | int line = 0; |
| | |
| | | UnSelectedImagePath = "PirIcon/Infraredtreasure.png", |
| | | }; |
| | | currpirdeviceFLayout.AddChidren(deviceIconBtn); |
| | | var iconNameBtn = new Button |
| | | var iconNameBtn = new Button |
| | | { |
| | | Y = deviceIconBtn.Bottom+Application.GetRealHeight(8), |
| | | Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(17), |
| | | TextSize = TextSize.text12, |
| | |
| | | GetIconAndText(i, deviceIconBtn, iconNameBtn); |
| | | clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; |
| | | int if_value =int.Parse(clickBtn.Tag.ToString()); |
| | | var list11 = new List<string> { |
| | | "爱你", "哎呦","埃及","哈弗换壳哈弗", "爱德华多v","俺几个疯了", |
| | | "拜了", "巴士", "百夫", "百合地理课你打算", "不度老骥伏枥", "比到九点", |
| | | "车站","测试","此地", "才看见好得快","吃软饭","从看见二十多", |
| | | "等待机会吧","的客户", "多喝点", "登记哦然后", "打电话", |
| | | "恩肤霜看就看了", "饿死os","恶魔城","儿科联动", "恩六颗子弹拉拉裤洗澡了","发大学生发发", |
| | | "真厉害i发多少", "知道你付款了发", "尬酒回复", "改进的话", "天天速度回答", "太好了开车", |
| | | "减肥的看过","桡出口处那","如果觉得", "很舒服的","吃软饭","从看见二十多", |
| | | "龙卷风亏大发","去好看", "多喝点", "好浪费好", "打电话"}; |
| | | System.Threading.Tasks.Task.Run(() => |
| | | int if_value = int.Parse(clickBtn.Tag.ToString()); |
| | | if (if_value == 7) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Method method = new Method(); |
| | | method.AddControl(this, (control) => |
| | | { |
| | | switch (if_value) |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | var strings = GetTypeString(if_value).Split('-'); |
| | | var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); |
| | | if (jobDeviceType == null) |
| | | { |
| | | return; |
| | | } |
| | | GetBrandList(jobDeviceType.id, (brandList) => |
| | | { |
| | | var brandSupportStrList = GetBrandSupport(if_value); |
| | | var strList = new List<string>(); |
| | | for (int str = 0; str < brandList.Count; str++) |
| | | { |
| | | case 1: |
| | | { |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | Method method = new Method(); |
| | | method.AddControl(); |
| | | |
| | | } |
| | | break; |
| | | string s = brandList[str].brandName; |
| | | var bool_if = brandSupportStrList.Find((c) => s.Contains(c)); |
| | | if (bool_if != null) |
| | | { |
| | | strList.Add(s); |
| | | } |
| | | |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | BrandList brandObj = new BrandList(); |
| | | MainPage.BasePageView.AddChidren(brandObj); |
| | | brandObj.Show(brandList, strList, strings[1]); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | | //BrandList brandList = new BrandList(); |
| | | //MainPage.BasePageView.AddChidren(brandList); |
| | | //brandList.Show(list11, null); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | }; |
| | | |
| | | } |
| | | GetDeviceTypeList(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取品牌支持 |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | private List<string> GetBrandSupport(int index) |
| | | { |
| | | List<string> strList = new List<string>(); |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | strList.Add("格力"); |
| | | strList.Add("美的"); |
| | | strList.Add("海尔"); |
| | | strList.Add("松下"); |
| | | strList.Add("海信"); |
| | | strList.Add("长虹"); |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | strList.Add("创维"); |
| | | strList.Add("TCL"); |
| | | strList.Add("海信"); |
| | | strList.Add("长虹"); |
| | | strList.Add("海尔"); |
| | | strList.Add("三星"); |
| | | strList.Add("乐视"); |
| | | strList.Add("索尼"); |
| | | strList.Add("LG乐金"); |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | return strList; |
| | | } |
| | | /// <summary> |
| | | /// 获取设备类型str |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | private string GetTypeString(int index) |
| | | { |
| | | string type = ""; |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | //空调 |
| | | type = "ac-" + SPK.AcIr; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | //电视 |
| | | type = "tv-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | //风扇 |
| | | type = "fan-" + SPK.ElectricFan; |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | //机顶盒 |
| | | // type = "set_top_box-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | //影碟机 |
| | | // type = "dvd-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | //投影仪 |
| | | // type = "projector-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | return type; |
| | | } |
| | | /// <summary> |
| | | /// 设置图片和备注 |
| | |
| | | /// <param name="index">索引值</param> |
| | | /// <param name="deviceIconBtn">图标Btn</param> |
| | | /// <param name="deviceNameBtn">设备备注Btn</param> |
| | | private void GetIconAndText(int index,Button deviceIconBtn, Button deviceNameBtn) { |
| | | string iconPath = ""; |
| | | int deviceNameIndex=0; |
| | | private void GetIconAndText(int index, Button deviceIconBtn, Button deviceNameBtn) |
| | | { |
| | | string iconPath = ""; |
| | | int deviceNameIndex = 0; |
| | | switch (index) |
| | | { |
| | | case 1: { |
| | | case 1: |
| | | { |
| | | iconPath = "PirIcon/air.png"; |
| | | deviceNameIndex = StringId.kongtiao; |
| | | } break; |
| | | case 2: { |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | iconPath = "PirIcon/tv.png"; |
| | | deviceNameIndex = StringId.dianshi; |
| | | } break; |
| | | case 3: { |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | iconPath = "PirIcon/fan.png"; |
| | | deviceNameIndex = StringId.fengshan; |
| | | } break; |
| | | case 4: { |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | iconPath = "PirIcon/stb.png"; |
| | | deviceNameIndex = StringId.jidinghe; |
| | | } break; |
| | | case 5: { |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | iconPath = "PirIcon/dvd.png"; |
| | | deviceNameIndex = StringId.dvd; |
| | | } break; |
| | | case 6: { |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | iconPath = "PirIcon/projector.png"; |
| | | deviceNameIndex = StringId.touyingyi; |
| | | } break; |
| | | case 7: { |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | iconPath = "PirIcon/custom.png"; |
| | | deviceNameIndex = StringId.zidingyi; |
| | | } break; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | deviceIconBtn.UnSelectedImagePath = iconPath; |
| | | deviceNameBtn.TextID = deviceNameIndex; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取红外设备类型列表 |
| | | /// </summary> |
| | | private void GetDeviceTypeList() |
| | | { |
| | | PirSend.GetDeviceTypesList(this, (responsePackNew) => |
| | | { |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | //清空之前数据 |
| | | DeviceTypeList.Clear(); |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var objDeviceType = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceType>(str); |
| | | if (objDeviceType != null) |
| | | { |
| | | if (null == DeviceTypeList.Find((c) => c.id == objDeviceType.id)) |
| | | { |
| | | DeviceTypeList.Add(objDeviceType); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | }, "", "设备类型列表"); |
| | | } |
| | | /// <summary> |
| | | /// 读取红外设备类型的品牌列表 |
| | | /// </summary> |
| | | private void GetBrandList(string id, Action<List<Brand>> actionBrand) |
| | | { |
| | | List<Brand> brandList = new List<Brand>(); |
| | | PirSend.GetDeviceTypesList(this, (responsePackNew) => |
| | | { |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | //清空之前数据 |
| | | brandList.Clear(); |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var brand = Newtonsoft.Json.JsonConvert.DeserializeObject<Brand>(str); |
| | | if (brand != null) |
| | | { |
| | | if (null == brandList.Find((c) => c.id == brand.id)) |
| | | { |
| | | brandList.Add(brand); |
| | | } |
| | | } |
| | | } |
| | | actionBrand(brandList); |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | }, id, "品牌列表"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public class PirSend |
| | | { |
| | | |
| | | public static string pirId = "1367032976869658625"; |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew GetDeviceList(string spk) |
| | | { |
| | | var jObject = new JObject { }; |
| | | jObject.Add("homeId", HomeId); |
| | | jObject.Add("spk", spk); |
| | | //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId); |
| | | //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//可控参数,当需要分页获取,怎么知道分页总数 |
| | | //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | //d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | //d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetDevcieList); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static ResponsePackNew ControlList(Pir pir) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 遥控器添加 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | /// <param name="control"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew Add(Control control) |
| | | { |
| | |
| | | jObject.Add("homeId", HomeId); |
| | | jObject.Add("deviceId", control.deviceId); |
| | | jObject.Add("name", control.name); |
| | | jObject.Add("spk", "ir.module"); |
| | | jObject.Add("spk", control.spk); |
| | | jObject.Add("type", control.type); |
| | | if (control.type == "library") |
| | | if (control.type=="library") |
| | | { |
| | | //jObject.Add("group_id", "123"); |
| | | jObject.Add("group_id", control.group_id); |
| | | var libraryjay = new JArray { }; |
| | | for (int i = 0; i < control.library.Count; i++) |
| | | { |
| | |
| | | } |
| | | jObject.Add("library", libraryjay); |
| | | } |
| | | |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_Add); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | ///红外码库试码 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew CodeTest(Control control) |
| | | { |
| | | var jObject = new JObject { }; |
| | | 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); |
| | | } |
| | | var libraryJay = new JArray { }; |
| | | for (int i = 0; i < control.library.Count; i++) |
| | | { |
| | | libraryJay.Add(control.library[i]); |
| | | } |
| | | var statusJay = new JArray { }; |
| | | for (int i = 0; i < control.status.Count; i++) |
| | | { |
| | | var statusJob = new JObject { }; |
| | | var job = control.status[i]; |
| | | statusJob.Add("key", job.Key); |
| | | statusJob.Add("value", job.value); |
| | | statusJay.Add(statusJob); |
| | | } |
| | | jObject.Add("library", libraryJay); |
| | | jObject.Add("status", statusJay); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeTest); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// <summary> |
| | | /// 红外码学习 |
| | | /// </summary> |
| | |
| | | job.Add("value", valuejArray); |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; |
| | | ResponsePackNew responsePackNew = null; |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | job.Add("value", valuejArray); |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); |
| | | return responsePackNew; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取逻辑 |
| | | /// 红外宝/遥控器删除 |
| | | /// </summary> |
| | | /// <param name="listIdList">逻辑ID列表</param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew GetLogic(List<string> listIdList) |
| | | public static ResponsePackNew DeleteDevice(string deviceId) |
| | | { |
| | | var jArray = new JArray { }; |
| | | for (int i = 0; i < listIdList.Count; i++) |
| | | { |
| | | jArray.Add(listIdList[i]); |
| | | } |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | GetLogic(listIdList); |
| | | } |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceDel); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 修改红外宝名称 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew DeviceRename(Pir pir) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename); |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 查询红外设备类型列表/品牌列表/品牌红外码库列表 |
| | | /// </summary> |
| | | /// <param name="frameLayout">加载log的父控件</param> |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetDeviceTypesList(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str) |
| | | { |
| | | |
| | | |
| | | DAL.Server.ResponsePackNew responsePackNew = null; |
| | | Loading loading = new Loading(); |
| | | frameLayout.AddChidren(loading); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | string url = ""; |
| | | var jObject = new JObject { }; |
| | | if (if_str == "设备类型列表") |
| | | { |
| | | url = "/smart-footstone/app/ir/device-type/list"; |
| | | } |
| | | else if (if_str == "品牌列表") |
| | | { |
| | | url = "/smart-footstone/app/ir/brand/list"; |
| | | jObject.Add("deviceTypeId", id); |
| | | } |
| | | else if (if_str == "品牌红外码库列表") |
| | | { |
| | | url = "/smart-footstone/app/ir/code/list"; |
| | | jObject.Add("brandId", id); |
| | | } |
| | | responsePackNew = RequestServerhomeId(jObject, url); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | action(responsePackNew); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
New file |
| | |
| | | using System; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View |
| | | { |
| | | |
| | | public class PirNameView |
| | | { |
| | | /// <summary> |
| | | /// 主控件 |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | | /// <summary> |
| | | /// 名称 |
| | | /// </summary> |
| | | public Button btnName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(144-38), |
| | | Height = Application.GetRealHeight(20), |
| | | X = Application.GetRealWidth(19), |
| | | TextAlignment = TextAlignment.Center, |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 线 |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Width = Application.GetRealWidth(144-32), |
| | | X = Application.GetRealWidth(16), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | }; |
| | | public Button btnClick = new Button |
| | | { |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public FrameLayout FLayoutView() |
| | | { |
| | | frameLayout.AddChidren(btnName); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnClick); |
| | | return frameLayout; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入框 |
| | | /// </summary> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void InputBox(FrameLayout frameLayout,string tnputEditTxet, Action<string, FrameLayout> confirmAction, bool if_bool = true) |
| | | { |
| | | FrameLayout frame = new FrameLayout() |
| | | { |
| | | BackgroundColor = MusicColor.PopupBackgroundColor, |
| | | }; |
| | | frameLayout.AddChidren(frame); |
| | | FrameLayout whiteView = new FrameLayout() |
| | | { |
| | | //Gravity = Gravity.Center, |
| | | X = Application.GetRealWidth(53), |
| | | Y = Application.GetRealHeight(264), |
| | | Width = Application.GetRealWidth(270), |
| | | Height = Application.GetRealHeight(201), |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), |
| | | }; |
| | | frame.AddChidren(whiteView); |
| | | |
| | | |
| | | Button btnTitle = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | X = Application.GetRealWidth(35), |
| | | Height = Application.GetRealHeight(22), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = MusicColor.SelectedColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = StringId.shuruyaokongqimingcheng, |
| | | |
| | | }; |
| | | 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 = MusicColor.ViewColor, |
| | | BorderColor = 0x00000000, |
| | | 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 = MusicColor.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 btnTipText = new Button |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = editBjView.Bottom + Application.GetRealHeight(12), |
| | | Width = Application.GetRealWidth(211), |
| | | Height = Application.GetRealHeight(35), |
| | | Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"), |
| | | IsMoreLines = true, |
| | | TextColor = MusicColor.MusicNoTxetColor, |
| | | TextSize = TextSize.Text12, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | whiteView.AddChidren(btnTipText); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | Y = whiteView.Height - Application.GetRealHeight(44 + 1), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = MusicColor.LineColor, |
| | | }; |
| | | whiteView.AddChidren(btnLine); |
| | | |
| | | Button btnCancel = new Button() |
| | | { |
| | | Y = btnLine.Bottom, |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = MusicColor.TextCancelColor, |
| | | 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 = MusicColor.WhiteColor, |
| | | IsBold = true, |
| | | TextSize = TextSize.Text16, |
| | | TextID = StringId.confirmMusic, |
| | | BackgroundColor = MusicColor.SelectedColor, |
| | | Gravity = Gravity.BottomRight, |
| | | }; |
| | | whiteView.AddChidren(btnConfirm); |
| | | btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | frame.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(editText.Text.Trim())) |
| | | { |
| | | return; |
| | | } |
| | | confirmAction(editText.Text.Trim(), frame); |
| | | if (if_bool) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |