| | |
| | | /// <summary> |
| | | /// 更新灯光状态 |
| | | /// </summary> |
| | | public static void UpdataState(Fan uFan) |
| | | public static void UpdataState(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | if (bodyView == null) |
| | | return; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.barGradualChange.ProgressBarColor = uFan.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.barGradualChange.Progress = uFan.openLevel; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.barGradualChange.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.OpenLevel)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = fan.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fan.GetRoomListName(); |
| | | //fan.SaveFunctionData(true); |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = function.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); |
| | | //function.SaveFunctionData(true); |
| | | }; |
| | | } |
| | | |
| | |
| | | void LoadCollectionEvent() |
| | | { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => { |
| | | btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | fan.CollectFunction(); |
| | | btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | function.CollectFunction(); |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.fan); |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", fan.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(fan, d); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.fan); |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", fan.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(fan, d); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | barGradualChange.OnProgressChangedEvent = (sender, e) => { |
| | | fan.openLevel = e; |
| | | function.SetAttrState(FunctionAttributeKey.OpenLevel, e.ToString()); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.fan); |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", fan.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(fan, d); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |