| | |
| | | public partial class ACPage |
| | | { |
| | | static DateTime updataTime = DateTime.MinValue; |
| | | public static void UpdataStates(AC uAc) |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | AC temp = new AC(); |
| | | updataTime = DateTime.Now; |
| | | bodyView.btnTemp.Text = uAc.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = uAc.GetModeIconPath(); |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = uAc.GetFanIconPath(); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (uAc.trait_on_off.curValue.ToString() == "on") |
| | | bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | bodyView.arcBar.IsOffline = false; |
| | | bodyView.btnSwitch.IsSelected = true; |
| | | bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | if (uAc.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") |
| | | if (updateTemp.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | bodyView.arcBar.IsClickable = false; |
| | | } |
| | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => |
| | | { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = aC.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = aC.GetRoomListName(); |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = function.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | aC.CollectFunction(); |
| | | btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | function.CollectFunction(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= aC.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= function.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | aC.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); |
| | | //Control.Send(CommandType_A.write, aC); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); |
| | | //Control.Send(CommandType_A.write, function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= aC.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= function.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | { |
| | | return; |
| | | } |
| | | temp++; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | aC.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | //aC.GetSendJObject |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | //function.GetSendJObject |
| | | |
| | | }; |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | aC.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | btnTemp.Text = arcBar.Progress.ToString(); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | aC.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | aC.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (aC.trait_on_off.curValue.ToString() == "on") |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, aC.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | } |
| | | |
| | |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | aC.SetAttrState(FunctionAttributeKey.Mode, curMode); |
| | | btnMode.UnSelectedImagePath = aC.GetModeIconPath(); |
| | | function.SetAttrState(FunctionAttributeKey.Mode, curMode); |
| | | btnMode.UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; |
| | | d.Add(FunctionAttributeKey.Mode, curMode); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | dialog.Close(); |
| | | if (aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | bodyView.arcBar.IsClickable = false; |
| | | } |
| | |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnFanIcon.IsSelected = btnFanText.IsSelected = true; |
| | | aC.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); |
| | | btnWindSpeed.UnSelectedImagePath = aC.GetFanIconPath(); |
| | | function.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); |
| | | btnWindSpeed.UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.FanSpeed, curFan); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; |
| | | dialog.Close(); |
| | | }; |