| | |
| | | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Server/NewAPI.cs"> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="66" Column="58" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="68" Column="88" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="191" Column="28" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="135" Column="46" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="1" Column="1" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="310" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="116" Column="21" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="136" Column="54" /> |
| | | <File FileName="HDL_ON/DAL/Server/NewAPI.cs" Line="327" Column="6" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="77" Column="36" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="305" Column="66" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="205" Column="8" /> |
| | | <File FileName="HDL-ON_Android/Assets/Language.ini" Line="1326" Column="5" /> |
| | | <File FileName="HDL_ON/Common/R.cs" Line="812" Column="33" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="301" Column="35" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="103" Column="40" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="Common" expanded="True" /> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | <Node name="Mqtt" expanded="True" /> |
| | | <Node name="Server" expanded="True"> |
| | | <Node name="NewAPI.cs" selected="True" /> |
| | | </Node> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True" /> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI0-Public" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="3-Intelligence" expanded="True"> |
| | | <Node name="Automation" expanded="True"> |
| | | <Node name="LogicView" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="4-PersonalCenter" expanded="True"> |
| | | <Node name="PirDevice" expanded="True"> |
| | | <Node name="View" expanded="True" /> |
| | | <Node name="Method.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" expanded="True"> |
| | | <Node name="Assets" expanded="True"> |
| | | <Node name="Phone" expanded="True"> |
| | | <Node name="PirIcon" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_iOS" expanded="True"> |
| | | <Node name="Resources" expanded="True" /> |
| | | <Node name="Assets" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </State> |
| | |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="323" column="1" /> |
| | | <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="310" column="1" /> |
| | | <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="301" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
| | |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6074=遥控器不能超过10个? |
| | | 6075=遥控器所属区域: |
| | | 6076=编辑信息 |
| | | |
| | | |
| | | |
| | | 7000=新建自动化 |
| | |
| | | 7045=设置 |
| | | 7046=名称 |
| | | 7047=修改名称 |
| | | 7048=自动化名称已存在 |
| | | 7048=名称已存在 |
| | | 7049=是否要删除自动化? |
| | | 7050=添加场景 |
| | | 7051=延时 |
| | |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6074=遥控器不能超过10个? |
| | | 6075=遥控器所属区域: |
| | | 6076=编辑信息 |
| | | |
| | | |
| | | |
| | |
| | | 7045=设置 |
| | | 7046=名称 |
| | | 7047=修改名称 |
| | | 7048=自动化名称已存在 |
| | | 7048=名称已存在 |
| | | 7049=是否要删除自动化? |
| | | 7050=添加场景 |
| | | 7051=延时 |
| | |
| | | public const int querenshanchu = 6072; |
| | | public const int quxiao = 6073; |
| | | public const int bunengchaoguo10 = 6074; |
| | | public const int yaokongqiquyu = 6075; |
| | | public const int bianjixinxi = 6076; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | Utlis.WriteLine($"StartCloudMqtt: 开始"); |
| | | |
| | | await Task.Factory.StartNew(async () => { |
| | | await Task.Factory.StartNew((Func<Task>)(async () => { |
| | | try |
| | | { |
| | | #region 初始化远程Mqtt |
| | |
| | | if (RemoteMqttClient.ApplicationMessageReceivedHandler == null) |
| | | { |
| | | //处理接收到的数据 |
| | | RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => { |
| | | RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => { |
| | | try |
| | | { |
| | | var topic = e.ApplicationMessage.Topic; |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontrondata = revString; |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.studybtndata = revString; |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | |
| | | } |
| | | } |
| | | catch { } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | //(2)DisconnectedHandler |
| | |
| | | Utlis.WriteLine($"StartCloudMqtt: 结束"); |
| | | } |
| | | |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | |
| | |
| | | /// 获取设备详情通过(spk,sid) |
| | | /// </summary> |
| | | public const string Api_Post_GetinfoBySid = "/home-wisdom/app/device/infoBySid"; |
| | | /// <summary> |
| | | /// 红外宝/遥控器删除 |
| | | /// </summary> |
| | | public const string API_POST_Ir_DeviceDel = "/home-wisdom/app/device/remove"; |
| | | /// <summary> |
| | | /// 修改设备名称 |
| | | /// </summary> |
| | | public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename"; |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// 河东获取萤石云子账号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 |
| | |
| | | <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" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\EditControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FrameLayout50.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\" />
|
| | |
| | | try |
| | | { |
| | | //发送按键删除; |
| | | responsePackNew = PirSend.CodeRemove(obj); |
| | | responsePackNew = PirSend.CodeRemove(obj, control.deviceId); |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | } |
| | | public void Show(Control control, bool bool_library) |
| | | { |
| | | //数据转换 |
| | | Entity.Function function = new Entity.Function(); |
| | | function.sid = control.sid; |
| | | function.deviceId = control.deviceId; |
| | | function.name = control.name; |
| | | function.spk = control.spk; |
| | | function.attributes.AddRange(function.attributes); |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | |
| | | this.AddChidren(namePatchView.FLayoutView()); |
| | | namePatchView.btnText1.TextID = StringId.yaokongqimingcheng; |
| | | namePatchView.btnText2.Text = control.name; |
| | | namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { |
| | | |
| | | List<string> list = new List<string>(); |
| | | |
| | | for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) |
| | | { |
| | | list.Add(Pir.currPir.FunctioList[i].name); |
| | | } |
| | | Method method = new Method(); |
| | | method.EditControlName(StringId.editName, list, control.name, (name, view) => |
| | | { |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | view.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | view.Close(); |
| | | namePatchView.btnText2.Text = name; |
| | | function.name = name; |
| | | } |
| | | else |
| | | { |
| | | Method methodError = new Method(); |
| | | methodError.ErrorShow(responsePackNew); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | |
| | | }, () => { }); |
| | | }; |
| | | //所属区域 |
| | | View.PatchView quyuPatchView = new View.PatchView(); |
| | | quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom; |
| | | this.AddChidren(quyuPatchView.FLayoutView()); |
| | | quyuPatchView.btnText1.TextID = StringId.suoshuquyu; |
| | | quyuPatchView.btnText2.TextID = StringId.dianqi; |
| | | quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function); |
| | | quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Method method = new Method(); |
| | | method.ManagementPosition(function, () => |
| | | { |
| | | //更新区域 |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function); |
| | | }); |
| | | }; |
| | | |
| | | |
| | | //继续添加 |
| | | Button addBtn = new Button |
| | |
| | | { |
| | | MainPage.BasePageView.RemoveViewByTag("AddControl"); |
| | | MainPage.BasePageView.RemoveViewByTag("Pir"); |
| | | |
| | | Entity.Function function = new Entity.Function(); |
| | | function.sid = control.sid; |
| | | function.deviceId = control.deviceId; |
| | | function.name = control.name; |
| | | function.spk = control.spk; |
| | | function.attributes.AddRange(function.attributes); |
| | | if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid)) |
| | | { |
| | | Pir.currPir.FunctioList.Add(function); |
| | |
| | | X = Application.GetRealWidth(311 + 16 - (40 + 100)), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = j.ToString(), |
| | | Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | |
| | | if (function != null) |
| | | { |
| | | pirDevice.FunctioList.Remove(Function); |
| | | if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid) |
| | | { |
| | | Pir.currPir.FunctioList = pirDevice.FunctioList; |
| | | } |
| | | } |
| | | UIView(vv); |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | EventHandler<MouseEventArgs> editClick = (sender, e) => |
| | | { |
| | | EditControl editControl = new EditControl(); |
| | | MainPage.BasePageView.AddChidren(editControl); |
| | | editControl.Show(control, pirDevice, (device) => |
| | | { |
| | | //回调更新名字/区域 |
| | | nameBtn.Text = device.name; |
| | | areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device); |
| | | |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | funControlRow.MouseUpEventHandler += editClick; |
| | | nameBtn.MouseUpEventHandler += editClick; |
| | | areaBtn.MouseUpEventHandler += editClick; |
| | | nextIconBtn.MouseUpEventHandler += editClick; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | list.Add(Pir.pirDeviceList[b].name); |
| | | } |
| | | TipPopView tipPopView = new TipPopView(); |
| | | tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) => |
| | | Method methodView = new Method(); |
| | | methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) => |
| | | { |
| | | pirclick.name = name; |
| | | //加载log |
| | |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.DeviceRename(pirclick); |
| | | responsePackNew = PirSend.DeviceRename(pirclick.deviceId, pirclick.name); |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | }, () => |
| | | { |
| | | },()=> { |
| | | NewSwitchView(pirclick, vv); |
| | | }, false); |
| | | },false); |
| | | |
| | | } |
| | | else |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | | public class EditControl : FrameLayout |
| | | { |
| | | public EditControl() |
| | | { |
| | | } |
| | | |
| | | public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action) |
| | | { |
| | | |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.pipeiyaokongqi; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | action(control); |
| | | RemoveFromParent(); |
| | | }; |
| | | topView.topNameBtn.TextID = StringId.bianjixinxi; |
| | | FrameLayout viewLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Width = Application.GetRealWidth(375), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | BackgroundColor = CSS.CSS_Color.viewMiddle, |
| | | }; |
| | | this.AddChidren(viewLayout); |
| | | |
| | | FrameLayout50 editNameFLayout = new FrameLayout50(); |
| | | editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":"; |
| | | editNameFLayout.btnEditText.Text = control.name; |
| | | editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28); |
| | | editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); |
| | | editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; |
| | | viewLayout.AddChidren(editNameFLayout.FLayoutView()); |
| | | |
| | | FrameLayout50 areaFLayout = new FrameLayout50(); |
| | | areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu); |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); |
| | | areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom; |
| | | viewLayout.AddChidren(areaFLayout.FLayoutView()); |
| | | |
| | | editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | List<string> list = new List<string>(); |
| | | |
| | | for (int i = 0; i < pir.FunctioList.Count; i++) |
| | | { |
| | | list.Add(pir.FunctioList[i].name); |
| | | } |
| | | Method method = new Method(); |
| | | method.EditControlName(StringId.editName,list, control.name, (name,view) => |
| | | { |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | view.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | view.Close(); |
| | | editNameFLayout.btnEditText.Text = name; |
| | | control.name = name; |
| | | } |
| | | else |
| | | { |
| | | Method methodError = new Method(); |
| | | methodError.ErrorShow(responsePackNew); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | |
| | | },()=> { }); |
| | | }; |
| | | areaFLayout.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Method method = new Method(); |
| | | method.ManagementPosition(control, () => |
| | | { |
| | | //更新区域 |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); |
| | | }); |
| | | }; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public class Method |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 管理位置 |
| | | /// </summary> |
| | | /// <param name="control">当前设备</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void ManagementPosition(Entity.Function control, Action action) |
| | | { |
| | | var view = new ChooseRoomPage(control, action); |
| | | MainPage.BasePageView.AddChidren(view); |
| | | view.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | /// <summary> |
| | | /// 修改名称 |
| | | /// </summary> |
| | | /// <param name="tipText">提示文本</param> |
| | | /// <param name="list">当前存在名称列表</param> |
| | | /// <param name="currName">当前名称</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void EditControlName(int tipText ,List<string> list, string currName, Action<string, Dialog> action,Action actionCancel, bool tag=false) |
| | | { |
| | | new View.TipView().InputBox(StringId.editName, currName, StringId.nameNull, StringId.NameAlreadyExists, list, (text, view |
| | | ) => |
| | | { |
| | | action(text,view); |
| | | }, () => { actionCancel(); }, tag); |
| | | } |
| | | /// <summary> |
| | | /// 添加遥控器的方法 |
| | | /// </summary> |
| | | /// <param name="frameLayout">log图标加载界面</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void AddControl(FrameLayout frameLayout, Action<Control> action) |
| | | { |
| | | View.TipView tipView = new View.TipView(); |
| | |
| | | /// <summary> |
| | | /// 发送遥控器命令方法 |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | /// <param name="frame"></param> |
| | | /// <param name="control">发送参数对象</param> |
| | | /// <param name="frame">log图标加载界面</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action) |
| | | { |
| | | DAL.Server.ResponsePackNew responsePackNew = null; |
| | |
| | | { |
| | | try |
| | | { |
| | | //发送添加命令 |
| | | responsePackNew = PirSend.Add(control); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | string sid = responsePackNew.Data.ToString(); |
| | | var mqttdate = MqttDate(sid); |
| | | var mqttdate =MqttDate(sid); |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | if (mqttdate != null) |
| | | { |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | control.sid = sid; |
| | | //休眠500毫秒,为等待云端创建deviceid; |
| | | System.Threading.Thread.Sleep(500); |
| | | GetControl(frame, control,(device)=> { |
| | | GetControl(frame, control, (device) => |
| | | { |
| | | if (device != null) |
| | | { |
| | | control.deviceId = device.deviceId; |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | |
| | | action(control); |
| | | } |
| | | else |
| | | { |
| | | //读取deviceid返回错误提示 |
| | | View.FailView failView = new View.FailView(); |
| | | failView.ShouError((view) => |
| | | { |
| | | view.Close(); |
| | | ThreadAddControl(control, frame, action); |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | ThreadAddControl(control, frame, action); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | ErrorShow(responsePackNew); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取红外设备列表 |
| | | /// </summary> |
| | | /// <param name="frame">log图标加载界面</param> |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetPirDeviceList(FrameLayout frame, Action action) |
| | | { |
| | | //清除之前列表; |
| | |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | /// <param name="frame">log图标加载界面</param> |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetControlList(FrameLayout frame, Action action) |
| | | { |
| | | //加载log |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取遥控器详细 |
| | | /// 获取设备详情通过(spk,sid) |
| | | /// </summary> |
| | | /// <param name="frame">log图标加载界面</param> |
| | | /// <param name="control">发送参数对象</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action) |
| | | { |
| | | Entity.Function function = null; |
| | |
| | | { |
| | | try |
| | | { |
| | | // 获取设备详情通过(spk,sid) |
| | | responsePackNew = PirSend.GetinfoBySid(control); |
| | | } |
| | | catch { } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// MQTT主题推送下来的数据(遥控器添加) |
| | | /// MQTT主题推送下来的数据 |
| | | /// </summary> |
| | | public static string addcontrondata = ""; |
| | | /// <summary> |
| | | /// MQTT主题推送下来的数据(学习按键) |
| | | /// </summary> |
| | | public static string studybtndata = ""; |
| | | |
| | | public static string mqttdata = ""; |
| | | /// <summary> |
| | | /// 判断这个主题是否是添加遥控器主题 |
| | | /// </summary> |
| | | /// <param name="sid">唯一标识</param> |
| | | /// <param name="timeValue">等待时间值</param> |
| | | /// <returns></returns> |
| | | public Cloud MqttDate(string sid,int timeValue=10) |
| | | public Cloud MqttDate(string sid, int timeValue = 10) |
| | | { |
| | | Cloud cloud=null; |
| | | Cloud cloud = null; |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000) |
| | | { |
| | | if (!string.IsNullOrEmpty(addcontrondata)) |
| | | if (!string.IsNullOrEmpty(mqttdata)) |
| | | { |
| | | var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontrondata); |
| | | for (int i = 0; i < cloudjson.objects.Count; i++) |
| | | try |
| | | { |
| | | var objects = cloudjson.objects[i]; |
| | | if (sid == objects.sid) |
| | | var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(mqttdata); |
| | | for (int i = 0; i < cloudjson.objects.Count; i++) |
| | | { |
| | | cloud = cloudjson; |
| | | break; |
| | | var objects = cloudjson.objects[i]; |
| | | if (sid == objects.sid) |
| | | { |
| | | cloud = cloudjson; |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | | catch { } |
| | | } |
| | | |
| | | } |
| | | return cloud; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 错误码提示 |
| | | /// </summary> |
| | | /// <param name="responsePackNew"></param> |
| | | public void ErrorShow(ResponsePackNew responsePackNew) |
| | | /// <param name="str"></param> |
| | | public void ErrorShow(ResponsePackNew responsePackNew,string str="") |
| | | { |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "14005") |
| | | { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); |
| | | |
| | | if (str == "删除遥控器") { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); |
| | | } |
| | | else |
| | | { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); |
| | | if (responsePackNew != null && responsePackNew.Code == "14005") |
| | | { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); |
| | | |
| | | } |
| | | else |
| | | { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | public class PirSend |
| | | { |
| | | |
| | | public static string pirId = "1367032976869658625"; |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | |
| | | /// 自学按键删除 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew CodeRemove(AttributesStatus buttonObj) |
| | | public static ResponsePackNew CodeRemove(AttributesStatus buttonObj,string deviceId) |
| | | { |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.key); |
| | |
| | | job.Add("value", valuejArray); |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); |
| | | return responsePackNew; |
| | | } |
| | |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 修改红外宝名称 |
| | | /// 修改红外宝/设备名称 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew DeviceRename(Pir pir) |
| | | public static ResponsePackNew DeviceRename(string deviceId,string name) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "name", name} }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename); |
| | | return responsePackNew; |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.UI.Music; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View |
| | | { |
| | | public class FrameLayout50 |
| | | { |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 文本描述 |
| | | /// </summary> |
| | | public Button btnText = new Button |
| | | { |
| | | TextSize = TextSize.Text16, |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(22), |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | X = Application.GetRealWidth(16), |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 编辑文本 |
| | | /// </summary> |
| | | public Button btnEditText = new Button |
| | | { |
| | | Width = Application.GetRealWidth(357 - 52 - 200 - 16), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.Text14, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | X = Application.GetRealWidth(200 + 16), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 图标 |
| | | /// </summary> |
| | | public Button btnNextIcon = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "LogicIcon/next.png", |
| | | X = Application.GetRealWidth(339), |
| | | |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 线 |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Width = Application.GetRealWidth(375 - 32), |
| | | X = Application.GetRealWidth(16), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | |
| | | }; |
| | | |
| | | public Button btnClick = new Button |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public FrameLayout FLayoutView() |
| | | { |
| | | btnText.Gravity = Gravity.CenterVertical; |
| | | btnText.TextAlignment = TextAlignment.CenterLeft; |
| | | btnNextIcon.Gravity = Gravity.CenterVertical; |
| | | btnEditText.Gravity = Gravity.CenterVertical; |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnEditText); |
| | | frameLayout.AddChidren(btnNextIcon); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnClick); |
| | | return frameLayout; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// 小框圆角值 |
| | | /// </summary> |
| | | public int radiusEditFrameLayout = 4; |
| | | /// <summary> |
| | | /// 输入框 |
| | | /// </summary> |
| | | /// <param name="titleId">标题文本</param> |
| | | /// <param name="tnputEditTxet">显示文本</param> |
| | | /// <param name="errorId_IsNullOrEmpty">输入框文本为空自定义提示错误文本</param> |
| | | /// <param name="errorId_PresenceP">检索已存在名称自定义提示错误文本</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | /// <param name="List">被检索列表</param> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string, Dialog> confirmAction, Action action, bool tag = true) |
| | | { |
| | | Dialog dialog = new Dialog() |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | |
| | | FrameLayout whiteView = new FrameLayout() |
| | | { |
| | | //Gravity = Gravity.Center, |
| | | X = Application.GetRealWidth(53), |
| | | Y = Application.GetRealHeight(264), |
| | | Width = Application.GetRealWidth(270), |
| | | Height = Application.GetRealHeight(172), |
| | | BackgroundColor = CSS_Color.view, |
| | | BorderColor = CSS_Color.viewTranslucence, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), |
| | | }; |
| | | dialog.AddChidren(whiteView); |
| | | |
| | | Button btnTitle = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | X = Application.GetRealWidth(35), |
| | | Height = Application.GetRealHeight(22), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = CSS_Color.textConfirmColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = titleId, |
| | | |
| | | }; |
| | | whiteView.AddChidren(btnTitle); |
| | | |
| | | FrameLayout editBjView = new FrameLayout() |
| | | { |
| | | // Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTitle.Bottom + Application.GetRealHeight(16), |
| | | X = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(222), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = CSS_Color.viewMiddle, |
| | | BorderColor = CSS_Color.viewTranslucence, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), |
| | | }; |
| | | whiteView.AddChidren(editBjView); |
| | | |
| | | EditText editText = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(12), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = tnputEditTxet, |
| | | TextColor = CSS_Color.textColor, |
| | | TextSize = TextSize.Text14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | |
| | | }; |
| | | editBjView.AddChidren(editText); |
| | | |
| | | Button clearIconBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(194), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "MusicIcon/clear.png", |
| | | }; |
| | | editBjView.AddChidren(clearIconBtn); |
| | | clearIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | editText.Text = ""; |
| | | }; |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | Y = whiteView.Height - Application.GetRealHeight(44 + 1), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.viewLine, |
| | | }; |
| | | whiteView.AddChidren(btnLine); |
| | | |
| | | Button btnCancel = new Button() |
| | | { |
| | | Y = btnLine.Bottom, |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.textTipColor, |
| | | TextSize = TextSize.Text16, |
| | | TextID = StringId.cancelMusic, |
| | | Gravity = Gravity.BottomLeft, |
| | | }; |
| | | whiteView.AddChidren(btnCancel); |
| | | btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); |
| | | Button btnConfirm = new Button() |
| | | { |
| | | X = btnCancel.Right, |
| | | Y = btnLine.Bottom, |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.view, |
| | | IsBold = true, |
| | | TextSize = TextSize.Text16, |
| | | TextID = StringId.confirmMusic, |
| | | BackgroundColor = CSS_Color.textConfirmColor, |
| | | Gravity = Gravity.BottomRight, |
| | | }; |
| | | whiteView.AddChidren(btnConfirm); |
| | | btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); |
| | | |
| | | dialog.Show(); |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | action(); |
| | | |
| | | }; |
| | | Button btnTip = new Button |
| | | { |
| | | Width = Application.GetRealWidth(0), |
| | | }; |
| | | whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件 |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | string listNameText = editText.Text.Trim(); |
| | | if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText)) |
| | | { |
| | | string tipMsgString = ""; |
| | | if (string.IsNullOrEmpty(editText.Text.Trim())) |
| | | { |
| | | tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); |
| | | } |
| | | else |
| | | { |
| | | tipMsgString = Language.StringByID(errorId_PresenceP); |
| | | } |
| | | |
| | | whiteView.Height = Application.GetRealHeight(183); |
| | | btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1); |
| | | btnCancel.Y = btnLine.Bottom; |
| | | btnCancel.Gravity = Gravity.BottomLeft; |
| | | btnConfirm.Y = btnLine.Bottom; |
| | | btnConfirm.Gravity = Gravity.BottomRight; |
| | | |
| | | btnTip.X = Application.GetRealWidth(24); |
| | | btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12); |
| | | btnTip.Width = Application.GetRealWidth(222); |
| | | btnTip.Height = Application.GetRealHeight(17); |
| | | btnTip.Text = tipMsgString; |
| | | btnTip.TextColor = CSS_Color.textRedColor; |
| | | btnTip.TextSize = TextSize.Text12; |
| | | btnTip.TextAlignment = TextAlignment.CenterLeft; |
| | | |
| | | return; |
| | | } |
| | | |
| | | |
| | | confirmAction(editText.Text.Trim(), dialog); |
| | | if (tag) |
| | | { |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入框 |