| | |
| | | FrameWhiteCentet1.AddChidren(hotDryView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.HotDry, "true"); |
| | | string onoff = hotDryView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.HotDry, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.HotDry, "true"); |
| | | d.Add(FunctionAttributeKey.HotDry, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | hotDryView.SetThouchEvent(eventHandler); |
| | |
| | | FrameWhiteCentet1.AddChidren(windDryView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.WindDry, "true"); |
| | | string onoff = windDryView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.WindDry, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.WindDry, "true"); |
| | | d.Add(FunctionAttributeKey.WindDry, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | windDryView.SetThouchEvent(eventHandler); |
| | |
| | | FrameWhiteCentet1.AddChidren(disinfectView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.Disinfect, "true"); |
| | | string onoff = disinfectView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.Disinfect, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Disinfect, "true"); |
| | | d.Add(FunctionAttributeKey.Disinfect, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | disinfectView.SetThouchEvent(eventHandler); |
| | |
| | | |
| | | index++; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 时间设置 |
| | | var timeSetView = new ClothesHangerControl( |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerTimeIcon.png", |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerTimeIconOn.png", |
| | | Language.StringByID(StringId.Time), |
| | | ""); |
| | | timeSetView.Width = Application.GetRealWidth(96); |
| | | timeSetView.Height = Application.GetRealHeight(74); |
| | | timeSetView.Y = Application.GetRealHeight(409); |
| | | timeSetView.X = Application.GetRealWidth(266 - 33); |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler_timeSetView = (sender, e) => |
| | | { |
| | | var setTimePage = new ClothesHangerSetTimePage(device); |
| | | MainPage.BasePageView.AddChidren(setTimePage); |
| | | setTimePage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | timeSetView.SetThouchEvent(eventHandler_timeSetView); |
| | | |
| | | FrameWhiteCentet1.AddChidren(timeSetView); |
| | | |
| | | #endregion |
| | | } |
| | |
| | | if (hotDryTimeLeftTemp != null) |
| | | { |
| | | hotDryView.ChangeTime(hotDryTimeLeftTemp.value); |
| | | MainPage.Log($"烘干剩余时间{hotDryTimeLeftTemp.value}"); |
| | | } |
| | | var windDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); |
| | | if (windDryTimeLeftTemp != null) |
| | | { |
| | | windDryView.ChangeTime(windDryTimeLeftTemp.value); |
| | | MainPage.Log($"风干剩余时间{windDryTimeLeftTemp.value}"); |
| | | } |
| | | var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); |
| | | if (disinfectTimeLeftTemp != null) |
| | | { |
| | | disinfectView.ChangeTime(disinfectTimeLeftTemp.value); |
| | | MainPage.Log($"消毒剩余时间{disinfectTimeLeftTemp.value}"); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | private Button btnTitle; |
| | | private Button btnTime; |
| | | /// <summary> |
| | | /// 倒计时时间 |
| | | /// </summary> |
| | | private int leftTime = 0; |
| | | /// <summary> |
| | | /// 控件是否点亮 |
| | | /// </summary> |
| | | public bool Lighting = false; |
| | | |
| | | |
| | | |
| | | public ClothesHangerControl(string iconPath1, string iconPath2,string title,string time) |
| | | { |
| | |
| | | /// <param name="newTime"></param> |
| | | public void ChangeTime (string newTime) |
| | | { |
| | | if(newTime == "0") |
| | | { |
| | | newTime = ""; |
| | | } |
| | | |
| | | int time = 0; |
| | | int.TryParse(newTime, out time); |
| | | time = time * 60; |
| | | |
| | | int.TryParse(newTime, out leftTime); |
| | | leftTime *= 60; |
| | | if (countdownThread == null) |
| | | { |
| | | countdownThread = new System.Threading.Thread(() => { |
| | | while(true) |
| | | { |
| | | if(time>1) |
| | | if(leftTime > 1) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = new TimeSpan(0, 0, time).ToString(); |
| | | btnTime.Text = new TimeSpan(0, 0, leftTime).ToString(); |
| | | }); |
| | | System.Threading.Thread.Sleep(1000); |
| | | time--; |
| | | leftTime--; |
| | | }else |
| | | { |
| | | Application.RunOnMainThread(() => |