| | |
| | | //初始化事件 |
| | | this.EventListener(); |
| | | //读取数据 |
| | | //this.ReadData(); |
| | | this.ReadData(); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | if (this.device == null) |
| | | { |
| | | //设备不在线控制失败 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (!this.device.online) |
| | | { |
| | | //设备不在线控制失败 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(key, value); |
| | | Send.Current.SendControlCommand(this.device, dic, action); |
| | |
| | | /// </summary> |
| | | private void ReadData() |
| | | { |
| | | if (this.device == null) |
| | | { |
| | | return; |
| | | } |
| | | CommonMethod.Current.Loading.Start(); |
| | | CommonMethod.Current.SunThread(() => |
| | | { |
| | | try |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | |
| | | var isRefreshDeviceStatus = Send.Current.RefreshDeviceStatus(new List<string> { this.device.deviceId }); |
| | | if (isRefreshDeviceStatus) |
| | | { |
| | | }); |
| | | var fun = Send.Current.GetDeviceInfo(this.device.deviceId); |
| | | if (fun != null) |
| | | { |
| | | //更新真实在线状态 |
| | | this.device.online = fun.online; |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch { } |
| | | finally |