| | |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | #region 点亮文本 |
| | | var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry); |
| | | var hotDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDry); |
| | | if (hotDryTemp != null) |
| | | { |
| | | hotDryView.SetViewStatus(hotDryTemp.value == "true"); |
| | | hotDryView.SetViewStatus(hotDryTemp.state == "true"); |
| | | } |
| | | var windDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDry); |
| | | var windDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDry); |
| | | if (windDryTemp != null) |
| | | { |
| | | windDryView.SetViewStatus(windDryTemp.value == "true"); |
| | | windDryView.SetViewStatus(windDryTemp.state == "true"); |
| | | } |
| | | var disinfectTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); |
| | | var disinfectTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); |
| | | if (disinfectTemp != null) |
| | | { |
| | | disinfectView.SetViewStatus(disinfectTemp.value == "true"); |
| | | disinfectView.SetViewStatus(disinfectTemp.state == "true"); |
| | | } |
| | | var lightTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.OnOff); |
| | | var lightTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.OnOff); |
| | | if (lightTemp != null) |
| | | { |
| | | lightingView.SetViewStatus(lightTemp.value == "on"); |
| | | lightingView.SetViewStatus(lightTemp.state == "on"); |
| | | } |
| | | Console.WriteLine($"时间戳:{device.time_stamp} 时间:{device.GeteTime()} 烘干:{hotDryTemp.state} 风干:{windDryTemp.state} 消毒:{disinfectTemp.state} 灯光状态:{lightTemp.state}"); |
| | | #endregion |
| | | |
| | | #region 修改时间 |
| | | var hotDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); |
| | | var hotDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); |
| | | if (hotDryTimeLeftTemp != null) |
| | | { |
| | | hotDryView.ChangeTime(hotDryTimeLeftTemp.value); |
| | | MainPage.Log($"烘干剩余时间{hotDryTimeLeftTemp.value}"); |
| | | hotDryView.ChangeTime(hotDryTimeLeftTemp.state); |
| | | } |
| | | var windDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); |
| | | var windDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); |
| | | if (windDryTimeLeftTemp != null) |
| | | { |
| | | windDryView.ChangeTime(windDryTimeLeftTemp.value); |
| | | MainPage.Log($"风干剩余时间{windDryTimeLeftTemp.value}"); |
| | | windDryView.ChangeTime(windDryTimeLeftTemp.state); |
| | | } |
| | | var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); |
| | | var disinfectTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); |
| | | if (disinfectTimeLeftTemp != null) |
| | | { |
| | | disinfectView.ChangeTime(disinfectTimeLeftTemp.value); |
| | | MainPage.Log($"消毒剩余时间{disinfectTimeLeftTemp.value}"); |
| | | disinfectView.ChangeTime(disinfectTimeLeftTemp.state); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新当前设备的状态缓存 |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | foreach (var data in i_LocalDevice.status) |
| | | { |
| | | //开关 |
| | | //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | /// 控件是否点亮 |
| | | /// </summary> |
| | | public bool Lighting = false; |
| | | |
| | | |
| | | |
| | | public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time) |
| | | { |
| | |
| | | btnTime = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTitle.Bottom, |
| | | Y = Application.GetRealHeight(74-32), |
| | | Height = Application.GetRealHeight(32), |
| | | Text = time, |
| | | TextColor = 0x00000000, |
| | |
| | | public void ChangeTime(string newTime) |
| | | { |
| | | int.TryParse(newTime, out leftTime); |
| | | leftTime *= 60; |
| | | if (leftTime > 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5, 3); |
| | | }); |
| | | leftTime--; |
| | | } |
| | | else if (leftTime == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = ""; |
| | | }); |
| | | } |
| | | if (countdownThread == null) |
| | | { |
| | | countdownThread = new System.Threading.Thread(() => |
| | | { |
| | | |
| | | while (true) |
| | | { |
| | | if (leftTime > 1) |
| | | if (leftTime > 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = new TimeSpan(0, 0, leftTime).ToString(); |
| | | btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5,3) ; |
| | | }); |
| | | System.Threading.Thread.Sleep(1000); |
| | | leftTime--; |
| | | } |
| | | else |
| | | else if(leftTime == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = ""; |
| | | }); |
| | | } |
| | | System.Threading.Thread.Sleep(60000); |
| | | } |
| | | }) |
| | | { IsBackground = true }; |