| | |
| | | /// </summary> |
| | | Button btnSwitch; |
| | | |
| | | AC acDevice; |
| | | AC acFunction = new AC(); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | acDevice = device as AC; |
| | | |
| | | base.ShowColltionButton = false; |
| | | base.SetTitleText(Language.StringByID(StringId.Electric)); |
| | |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.MainColor, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off", |
| | | MinValue = device.GetAttribute(FunctionAttributeKey.OnOff).min, |
| | | MaxValue = device.GetAttribute(FunctionAttributeKey.OnOff).max, |
| | | //IsClickable = acDevice.trait_on_off.curValue.ToString() == "on", |
| | | ArcColor = CSS_Color.BackgroundColor, |
| | | Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)), |
| | | #if __IOS__ |
| | | Y = Application.GetRealHeight(120 + 25), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | |
| | | |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(arcBar); |
| | | |
| | | |
| | | arcBar.ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off"; |
| | | arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min; |
| | | arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max; |
| | | arcBar.Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | |
| | | btnTemp = new Button() |
| | | { |
| | |
| | | Y = Application.GetRealHeight(334), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acDevice.GetModeIconPath(), |
| | | UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)), |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnMode); |
| | | |
| | |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acDevice.GetFanIconPath(), |
| | | UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)), |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnWindSpeed); |
| | | |
| | |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | | |
| | | btnModeIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); |
| | | btnModeIcon.SelectedImagePath = acDevice.GetModeIconPath(); |
| | | btnModeText.Text = acDevice.GetModeAttrText( m); |
| | | btnModeIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m, false); |
| | | btnModeIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnModeText.Text = acFunction.GetModeAttrText( m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | acDevice.SetAttrState(FunctionAttributeKey.Mode, m); |
| | | btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); |
| | | device.SetAttrState(FunctionAttributeKey.Mode, m); |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(m); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; |
| | | d.Add(FunctionAttributeKey.Mode, m); |
| | | Control.Ins.SendWriteCommand(acDevice, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | dialog.Close(); |
| | | if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | | btnFanIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); |
| | | btnFanIcon.SelectedImagePath = acDevice.GetModeIconPath(); |
| | | btnFanText.Text = acDevice.GetModeAttrText(m); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnFanText.Text = acFunction.GetModeAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnFanIcon.IsSelected = btnFanText.IsSelected = true; |
| | | acDevice.SetAttrState(FunctionAttributeKey.FanSpeed, m); |
| | | btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); |
| | | device.SetAttrState(FunctionAttributeKey.FanSpeed, m); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.FanSpeed, m); |
| | | Control.Ins.SendWriteCommand(acDevice, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; |
| | | dialog.Close(); |
| | | }; |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= acDevice.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | device.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(acDevice, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= acDevice.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | { |
| | | return; |
| | | } |
| | | temp++; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | device.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(acDevice, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | acDevice.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | device.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(acDevice, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | acDevice.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | } |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (acDevice.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (acDevice.trait_on_off.curValue.ToString() == "off") |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | acDevice.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (acDevice.trait_on_off.curValue.ToString() == "on") |
| | | device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.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, acDevice.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(acDevice, d); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | | |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); |
| | | btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (acDevice.trait_on_off.curValue.ToString() == "on") |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | arcBar.IsOffline = false; |
| | | btnSwitch.IsSelected = true; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |