From c9dd765615b4bc6577ad39a9d6abcf33c735e685 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 27 八月 2021 13:21:19 +0800
Subject: [PATCH] 1
---
HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs | 148 ++++++++++++++++++++++++++++++++++++------------
1 files changed, 110 insertions(+), 38 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs
index b2d0460..e6f08bd 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs
@@ -66,19 +66,21 @@
fanSpeedList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value;
btnFan.MouseUpEventHandler += (sender, e) =>
{
- if( !btnSwitch.IsSelected){return;}
- var curFanSpeedIndex = fanSpeedList.IndexOf(device.GetAttrState(FunctionAttributeKey.FanSpeed));
- var sendFanSpeedIndex = curFanSpeedIndex == fanSpeedList.Count - 1 ? 0 : 1+curFanSpeedIndex;
+ ShowFanSelectView();
+ //return;
+ //if ( !btnSwitch.IsSelected){return;}
+ //var curFanSpeedIndex = fanSpeedList.IndexOf(device.GetAttrState(FunctionAttributeKey.FanSpeed));
+ //var sendFanSpeedIndex = curFanSpeedIndex == fanSpeedList.Count - 1 ? 0 : 1+curFanSpeedIndex;
- device.SetAttrState(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]);
- new System.Threading.Thread(() =>
- {
- Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]);
- Control.Ins.SendWriteCommand(device, d);
- })
- { IsBackground = true }.Start();
- RefreshFanSpeed();
+ //device.SetAttrState(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]);
+ //new System.Threading.Thread(() =>
+ //{
+ // Dictionary<string, string> d = new Dictionary<string, string>();
+ // d.Add(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]);
+ // Control.Ins.SendWriteCommand(device, d);
+ //})
+ //{ IsBackground = true }.Start();
+ //RefreshFanSpeed();
};
//椋庨�熸枃鏈�
this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
@@ -140,40 +142,107 @@
};
frameBack.Show();
+ var fanAttr = device.GetAttribute(FunctionAttributeKey.FanSpeed);
+ if(fanAttr == null)
+ {
+ return;
+ }
+ var valueCount = fanAttr.value.Count;
+
//鑿滃崟鎺т欢(椋庨��)
- var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.FanSpeed));
- menuContr.X = Application.GetRealWidth(209);
+ var menuContr = new DialogTitleMenuControl(valueCount, Language.StringByID(StringId.FanSpeed));
+ //menuContr.X = Application.GetRealWidth(209);
+ menuContr.Gravity = Gravity.CenterHorizontal;
menuContr.Y = Application.GetRealHeight(231);
menuContr.Width = Application.GetRealWidth(160);
- menuContr.Height = Application.GetRealHeight(199);
+ if (valueCount > 2)
+ {
+ menuContr.Height = Application.GetRealHeight(199);
+ }
+ else
+ {
+ menuContr.Height = Application.GetRealHeight(154);
+ }
dialogBody.AddChidren(menuContr);
- //1妗�
- var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low" ? "FunctionIcon/AirFresh/Fan1Select.png" : "FunctionIcon/AirFresh/Fan1.png";
- menuContr.AddRowMenu(Language.StringByID(StringId.FanOneGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low", () =>
+ foreach(var fanAttrValue in fanAttr.value)
{
- frameBack.Close();
- //鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "low");
- });
+ bool isSelecte = false;
+ var iconPath = "FunctionIcon/AirFresh/Fan1.png";
+ string text = Language.StringByID(StringId.FanOneGear);
+ if (fanAttrValue == "low" || fanAttrValue == "level_1")
+ {
+ text = Language.StringByID(StringId.LowWindSpeed);
+ if (this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low"|| this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "level_1")
+ {
+ iconPath = "FunctionIcon/AirFresh/Fan1Select.png";
+ isSelecte = true;
+ }
+ }
+ else if (fanAttrValue == "medium" || fanAttrValue == "level_2")
+ {
+ text = Language.StringByID(StringId.MiddleWindSpeed);
+ iconPath = "FunctionIcon/AirFresh/Fan2.png";
+ if (this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium" || this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "level_2")
+ {
+ iconPath = "FunctionIcon/AirFresh/Fan2Select.png";
+ isSelecte = true;
+ }
+ }
+ else if (fanAttrValue == "high" || fanAttrValue == "level_3")
+ {
+ text = Language.StringByID(StringId.HighWindSpeed);
+ iconPath = "FunctionIcon/AirFresh/Fan3.png";
+ if (this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high" || this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "level_3")
+ {
+ iconPath = "FunctionIcon/AirFresh/Fan3Select.png";
+ isSelecte = true;
+ }
+ }
- //2妗�
- iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium" ? "FunctionIcon/AirFresh/Fan2Select.png" : "FunctionIcon/AirFresh/Fan2.png";
- menuContr.AddRowMenu(Language.StringByID(StringId.FanTwoGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium", () =>
- {
- frameBack.Close();
- //鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "medium");
- });
+ menuContr.AddRowMenu(text, iconPath, isSelecte, () =>
+ {
+ frameBack.Close();
+ //鍙戦�佹。浣嶅懡浠�
+ this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, fanAttrValue);
+ });
+ }
- //3妗�
- iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high" ? "FunctionIcon/AirFresh/Fan3Select.png" : "FunctionIcon/AirFresh/Fan3.png";
- menuContr.AddRowMenu(Language.StringByID(StringId.FanThreeGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high", () =>
- {
- frameBack.Close();
- //鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "high");
- });
+ //if (fanAttr.value.Contains("low"))
+ //{
+ // //1妗�
+ // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low" ? "FunctionIcon/AirFresh/Fan1Select.png" : "FunctionIcon/AirFresh/Fan1.png";
+ // menuContr.AddRowMenu(Language.StringByID(StringId.FanOneGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low", () =>
+ // {
+ // frameBack.Close();
+ // //鍙戦�佹。浣嶅懡浠�
+ // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "low");
+ // });
+ //}
+
+ //if (fanAttr.value.Contains("medium"))
+ //{
+ // //2妗�
+ // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium" ? "FunctionIcon/AirFresh/Fan2Select.png" : "FunctionIcon/AirFresh/Fan2.png";
+ // menuContr.AddRowMenu(Language.StringByID(StringId.FanTwoGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium", () =>
+ // {
+ // frameBack.Close();
+ // //鍙戦�佹。浣嶅懡浠�
+ // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "medium");
+ // });
+ //}
+
+ //if (fanAttr.value.Contains("high"))
+ //{
+ // //3妗�
+ // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high" ? "FunctionIcon/AirFresh/Fan3Select.png" : "FunctionIcon/AirFresh/Fan3.png";
+ // menuContr.AddRowMenu(Language.StringByID(StringId.FanThreeGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high", () =>
+ // {
+ // frameBack.Close();
+ // //鍙戦�佹。浣嶅懡浠�
+ // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "high");
+ // });
+ //}
}
#endregion
@@ -300,5 +369,8 @@
#endregion
+
+
+
}
}
--
Gitblit v1.8.0