From 675df74cdd4103ffdcbfa0a6ccfc105fd61af15a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 29 十月 2021 15:44:18 +0800
Subject: [PATCH] 2021-10-29 1.更新乐橙 AndroidSDK
---
HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs | 328 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 299 insertions(+), 29 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
index 9a6c5c9..848c823 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
@@ -37,6 +37,11 @@
/// </summary>
private NormalViewControl btnFilterScreen = null;
/// <summary>
+ /// 婊ょ綉浣跨敤瓒呮椂鎻愮ず
+ /// </summary>
+ FrameLayout filterScreenTipView;
+
+ /// <summary>
/// 鑺傝兘/鑸掗�傚浘鏍囨帶浠�
/// </summary>
private IconViewControl btnMode1 = null;
@@ -60,6 +65,14 @@
/// 椋庨�熸枃鏈帶浠�
/// </summary>
private NormalViewControl btnFanView = null;
+ /// <summary>
+ /// 婀垮害璁剧疆鍥炬爣鎺т欢
+ /// </summary>
+ private IconViewControl btnSetHumidity = null;
+ /// <summary>
+ /// 婀垮害璁剧疆鏂囨湰鎺т欢
+ /// </summary>
+ private NormalViewControl btnSetHumidityView = null;
/// <summary>
/// 寮�鍏冲浘鏍�
/// </summary>
@@ -96,6 +109,8 @@
this.RefreshNowDeviceStatuMemory(this.device);
//鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
this.InitFrameWhiteContent1();
+
+ Control.Ins.SendReadCommand(device);
}
/// <summary>
@@ -184,6 +199,52 @@
btnFilterScreen.TextColor = CSS_Color.MainColor;
this.FrameWhiteCentet1.AddChidren(btnFilterScreen);
+ #region 婊ょ綉浣跨敤瓒呮椂鎻愰啋
+ filterScreenTipView = new FrameLayout()
+ {
+ Y = btnFilterScreen.Bottom + Application.GetRealWidth(8),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(295),
+ Height = Application.GetRealHeight(28),
+ Radius = (uint)Application.GetRealWidth(4),
+ BackgroundColor = 0xFFffE8E8,
+ Visible = false,
+ };
+ this.FrameWhiteCentet1.AddChidren(filterScreenTipView);
+
+ Button btnFilterScreenUseTip = new Button()
+ {
+ X = Application.GetRealWidth(8),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetRealWidth(20),
+ Height = Application.GetRealWidth(20),
+ UnSelectedImagePath = "FunctionIcon/AirFresh/btnInfoIcon.png"
+ };
+ filterScreenTipView.AddChidren(btnFilterScreenUseTip);
+
+ Button btnFilterScreenUseTipText = new Button()
+ {
+ X = Application.GetRealWidth(32),
+ Width = Application.GetRealWidth(340),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = 0xFFFF4747,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ };
+ if(Language.CurrentLanguage == "Chinese")
+ {
+ btnFilterScreenUseTipText.Text = "杩囨护缃戜娇鐢ㄨ秴鏃�";
+ }
+ else
+ {
+ btnFilterScreenUseTipText.Text = "Filter use timeout";
+ }
+ filterScreenTipView.AddChidren(btnFilterScreenUseTipText);
+
+
+ #endregion
+
+
+ #region 鑺傝兘
//鑺傝兘/鑸掗�傚浘鏍�
this.btnMode1 = new IconViewControl(28);
btnMode1.X = Application.GetRealWidth(42);
@@ -195,17 +256,20 @@
this.ShowMode1SelectView();
};
//鑺傝兘/鑸掗�傛枃鏈�
- this.btnMode1View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+ this.btnMode1View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
+ btnMode1View.X = Application.GetRealWidth(21);
btnMode1View.Y = btnMode1.Bottom + Application.GetRealHeight(6);
btnMode1View.TextAlignment = TextAlignment.Center;
btnMode1View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnMode1View.TextColor = CSS_Color.TextualColor;
this.FrameWhiteCentet1.AddChidren(btnMode1View);
+ #endregion
+ #region 妯″紡
//閫氶/鍔犳箍鍥炬爣
this.btnMode2 = new IconViewControl(28);
btnMode2.Y = btnMode1.Y;
- btnMode2.Gravity = Gravity.CenterHorizontal;
+ btnMode2.X = Application.GetRealWidth(114);
this.FrameWhiteCentet1.AddChidren(btnMode2);
btnMode2.ButtonClickEvent += (sender, e) =>
{
@@ -213,17 +277,20 @@
this.ShowMode2SelectView();
};
//閫氶/鍔犳箍鏂囨湰
- this.btnMode2View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+ this.btnMode2View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
btnMode2View.X = btnMode1View.Right;
btnMode2View.Y = btnMode2.Bottom + Application.GetRealHeight(6);
btnMode2View.TextAlignment = TextAlignment.Center;
btnMode2View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnMode2View.TextColor = CSS_Color.TextualColor;
this.FrameWhiteCentet1.AddChidren(btnMode2View);
+ #endregion
+ #region 椋庨��
//椋庨�熷浘鏍�
this.btnFan = new IconViewControl(28);
- btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize;
+ //btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize;
+ btnFan.X = Application.GetRealWidth(186);
btnFan.Y = btnMode1.Y;
this.FrameWhiteCentet1.AddChidren(btnFan);
btnFan.ButtonClickEvent += (sender, e) =>
@@ -232,16 +299,42 @@
this.ShowFanSelectView();
};
//椋庨�熸枃鏈�
- this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+ this.btnFanView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
btnFanView.X = btnMode2View.Right;
btnFanView.Y = btnFan.Bottom + Application.GetRealHeight(6);
btnFanView.TextAlignment = TextAlignment.Center;
btnFanView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnFanView.TextColor = CSS_Color.TextualColor;
this.FrameWhiteCentet1.AddChidren(btnFanView);
+ #endregion
+
+
+ #region 婀垮害
+ //婀垮害鍥炬爣
+ this.btnSetHumidity = new IconViewControl(28);
+ btnSetHumidity.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnSetHumidity.IconSize;
+ btnSetHumidity.Y = btnMode1.Y;
+ btnSetHumidity.UnSelectedImagePath = "FunctionIcon/AirFresh/HumiIcon.png";
+ btnSetHumidity.SelectedImagePath = "FunctionIcon/AirFresh/HumiOnIcon.png";
+ this.FrameWhiteCentet1.AddChidren(btnSetHumidity);
+
+ btnSetHumidity.ButtonClickEvent += (sender, e) =>
+ {
+ LoadEditDialog_Humi();
+ };
+ //婀垮害鏂囨湰
+ this.btnSetHumidityView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
+ btnSetHumidityView.X = btnFanView.Right;
+ btnSetHumidityView.Y = btnSetHumidity.Bottom + Application.GetRealHeight(6);
+ btnSetHumidityView.TextAlignment = TextAlignment.Center;
+ btnSetHumidityView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
+ btnSetHumidityView.TextColor = CSS_Color.TextualColor;
+ btnSetHumidityView.Text = "0%";
+ this.FrameWhiteCentet1.AddChidren(btnSetHumidityView);
+ #endregion
//寮�鍏冲浘鏍�
- this.btnSwitch = new IconViewControl(40);
+ this.btnSwitch = new IconViewControl(32);
btnSwitch.Gravity = Gravity.CenterHorizontal;
btnSwitch.Y = Application.GetRealHeight(468);
btnSwitch.UnSelectedImagePath = "Public/PowerClose.png";
@@ -291,7 +384,7 @@
{
frameBack.Close();
//鍙戦�佽妭鑳藉懡浠�
- this.SendOtherComand(this.btnMode1, "energy", "true");
+ this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "true");
});
//鑸掗��
@@ -300,7 +393,7 @@
{
frameBack.Close();
//鍙戦�佽垝閫傚懡浠�
- this.SendOtherComand(this.btnMode1, "energy", "false");
+ this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "false");
});
}
@@ -327,7 +420,7 @@
//鑿滃崟鎺т欢(妯″紡)
var menuContr = new DialogTitleMenuControl(2, Language.StringByID(StringId.Mode));
menuContr.Y = Application.GetRealHeight(277);
- menuContr.Gravity = Gravity.CenterHorizontal;
+ menuContr.X = Application.GetRealWidth(72);
menuContr.Width = Application.GetRealWidth(160);
menuContr.Height = Application.GetRealHeight(154);
dialogBody.AddChidren(menuContr);
@@ -338,7 +431,7 @@
{
frameBack.Close();
//鍙戦�侀�氶鍛戒护
- this.SendOtherComand(this.btnMode2, "mode", "fan");
+ this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "fan");
});
//鍔犳箍
@@ -347,11 +440,137 @@
{
frameBack.Close();
//鍙戦�佸姞婀垮懡浠�
- this.SendOtherComand(this.btnMode2, "mode", "humidification");
+ this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "humidification");
});
}
#endregion
+
+
+ /// <summary>
+ /// 鍔犺浇婀垮害閫夋嫨寮圭獥
+ /// </summary>
+ /// <param name="function"></param>
+ /// <param name="btn"></param>
+ void LoadEditDialog_Humi()
+ {
+ List<string> pickerItems = new List<string>();
+
+ Dialog dialog = new Dialog();
+
+ var pView = new FrameLayout()
+ {
+ BackgroundColor = CSS_Color.DialogTransparentColor1,
+ };
+ dialog.AddChidren(pView);
+
+ var optionBaseView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(456 - 60),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(260),
+ AnimateSpeed = 0.3f,
+ Animate = Animate.DownToUp,
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ pView.AddChidren(optionBaseView);
+
+ var topView = new FrameLayout()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(40),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ optionBaseView.AddChidren(topView);
+ topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+
+ var btnTilteText = new Button()
+ {
+ Width = Application.GetRealWidth(200),
+ Gravity = Gravity.CenterHorizontal,
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ IsBold = true,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ };
+ if(Language.CurrentLanguage == "Chinese")
+ {
+ btnTilteText.Text = "婀垮害璁惧畾";
+ }
+ else
+ {
+ btnTilteText.Text = "Humidity setting";
+ }
+ topView.AddChidren(btnTilteText);
+
+ var btnCancel = new Button()
+ {
+ X = Application.GetRealWidth(21),
+ Width = Application.GetRealWidth(100),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextID = StringId.Cancel,
+ };
+ topView.AddChidren(btnCancel);
+
+ var btnConfrim = new Button()
+ {
+ Width = Application.GetRealWidth(320),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextID = StringId.Confirm,
+ };
+ topView.AddChidren(btnConfrim);
+
+ UIPickerView uIPickerView = new UIPickerView()
+ {
+ Y = Application.GetRealHeight(40),
+ Height = Application.GetRealHeight(210),
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ for (int i = 0; i <= 100; i ++)
+ {
+ pickerItems.Add(i.ToString());
+ }
+ uIPickerView.setNPicker(pickerItems, null, null);
+ optionBaseView.AddChidren(uIPickerView);
+ //uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
+
+ string selectItem = pickerItems[0];
+ //if (pickerItems.Contains(trait.value + trait.GetUintString()))
+ //{
+ // selectItem = trait.value.ToString() + trait.GetUintString();
+ //}
+
+ dialog.Show();
+
+ pView.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ };
+
+ btnCancel.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ };
+ uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+ selectItem = pickerItems[int1];
+ };
+ btnConfrim.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ this.SendOtherComand(this.btnSetHumidity, FunctionAttributeKey.Humidity, selectItem);
+ this.btnSetHumidityView.Text = selectItem + "%";
+ //btn.Text = selectItem;
+ //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
+ //trait.value = selectItem.Replace(trait.GetUintString(), "");
+ };
+
+ }
+
#region 鈻� 鏄剧ず椋庨�熼�夋嫨鐣岄潰___________________
@@ -373,7 +592,7 @@
//鑿滃崟鎺т欢(椋庨��)
var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.FanSpeed));
- menuContr.X = Application.GetRealWidth(209);
+ menuContr.X = Application.GetRealWidth(80+62);
menuContr.Y = Application.GetRealHeight(231);
menuContr.Width = Application.GetRealWidth(160);
menuContr.Height = Application.GetRealHeight(199);
@@ -385,7 +604,7 @@
{
frameBack.Close();
//鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, "fan", "level_1");
+ this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_1");
});
//2妗�
@@ -394,7 +613,7 @@
{
frameBack.Close();
//鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, "fan", "level_2");
+ this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_2");
});
//3妗�
@@ -403,7 +622,7 @@
{
frameBack.Close();
//鍙戦�佹。浣嶅懡浠�
- this.SendOtherComand(this.btnFan, "fan", "level_3");
+ this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_3");
});
}
@@ -439,6 +658,12 @@
this.btnSwitch.IsSelected = this.airFreshData.Open;
//婊ょ綉鍓╀綑
this.btnFilterScreen.Text = this.dicText["婊ょ綉鍓╀綑"] + this.airFreshData.Filter_remain + "%";
+
+ if(this.airFreshData.Filter_timeout)
+ {
+ this.filterScreenTipView.Visible = true;
+ }
+
//瀹ゅ唴婀垮害
if (this.btnHumidity.Text == string.Empty || Convert.ToDecimal(this.btnHumidity.Text) != this.airFreshData.Indoor_humidity)
@@ -514,7 +739,13 @@
}
this.btnFan.IsSelected = this.airFreshData.Open;
this.btnFan.CanClick = this.airFreshData.Open;
+
+ this.btnSetHumidityView.Text = this.airFreshData.Humidity.ToString() + "%";
+ this.btnSetHumidity.Enable = this.airFreshData.Open;
+ this.btnSetHumidity.CanClick = this.airFreshData.Open;
+ this.btnSetHumidity.IsSelected = this.airFreshData.Open;
}
+
#endregion
@@ -532,9 +763,10 @@
HdlThreadLogic.Current.RunThread(() =>
{
- var dic = new Dictionary<string, string>();
- dic.Add(comadKey, comadValue);
- Control.Ins.SendWriteCommand(this.device, dic, true);
+ //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑)
+ var dic = this.GetSendComandSample();
+ dic[comadKey] = comadValue;
+ Control.Ins.SendWriteCommand(this.device, dic);
HdlThreadLogic.Current.RunMain(() =>
{
btnIcon.CanClick = true;
@@ -552,14 +784,40 @@
string statu = this.btnSwitch.IsSelected == true ? "off" : "on";
HdlThreadLogic.Current.RunThread(() =>
{
- var dic = new Dictionary<string, string>();
- dic.Add(FunctionAttributeKey.OnOff, statu);
- Control.Ins.SendWriteCommand(this.device, dic, true);
+ //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑)
+ var dic = this.GetSendComandSample();
+ dic[FunctionAttributeKey.OnOff] = statu;
+ Control.Ins.SendWriteCommand(this.device, dic);
HdlThreadLogic.Current.RunMain(() =>
{
this.btnSwitch.CanClick = true;
});
});
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑)
+ /// </summary>
+ /// <returns></returns>
+ private Dictionary<string, string> GetSendComandSample()
+ {
+ var dic = new Dictionary<string, string>();
+ //寮�鍏�
+ dic[FunctionAttributeKey.OnOff] = this.airFreshData.Open == true ? "on" : "off";
+ //妯″紡
+ dic[FunctionAttributeKey.Mode] = this.airFreshData.Mode;
+ //鑺傝兘
+ dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy;
+ //椋庨��
+ dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ;
+ //婀垮害
+ dic[FunctionAttributeKey.Humidity] = this.airFreshData.Humidity.ToString();
+ //瀹ゅ唴娓╁害
+ dic[FunctionAttributeKey.IndoorTemp] = this.airFreshData.Indoor_temp.ToString();
+ ///瀹ゅ唴婀垮害
+ dic[FunctionAttributeKey.IndoorHumidity] = this.airFreshData.Indoor_humidity.ToString();
+
+ return dic;
}
#endregion
@@ -575,15 +833,15 @@
{
var data = i_LocalDevice.attributes[i];
//寮�鍏�
- if (data.key == "on_off") { this.airFreshData.Open = data.state == "on"; }
+ if (data.key == FunctionAttributeKey.OnOff) { this.airFreshData.Open = data.state == "on"; }
//妯″紡
- else if (data.key == "mode") { this.airFreshData.Mode = data.state; }
+ else if (data.key == FunctionAttributeKey.Mode) { this.airFreshData.Mode = data.state; }
//鑺傝兘
- else if (data.key == "energy") { this.airFreshData.Energy = data.state; }
+ else if (data.key == FunctionAttributeKey.Energy) { this.airFreshData.Energy = data.state; }
//椋庨��
- else if (data.key == "fan") { this.airFreshData.Fan = data.state; }
+ else if (data.key == FunctionAttributeKey.FanSpeed) { this.airFreshData.Fan = data.state; }
//婀垮害
- else if (data.key == "humidity")
+ else if (data.key == FunctionAttributeKey.Humidity)
{
if (data.state != string.Empty)
{
@@ -591,7 +849,7 @@
}
}
//瀹ゅ唴娓╁害
- else if (data.key == "indoor_temp")
+ else if (data.key == FunctionAttributeKey.IndoorTemp)
{
if (data.state != string.Empty)
{
@@ -599,7 +857,7 @@
}
}
//瀹ゅ唴婀垮害
- else if (data.key == "indoor_humidity")
+ else if (data.key == FunctionAttributeKey.IndoorHumidity)
{
if (data.state != string.Empty)
{
@@ -607,11 +865,19 @@
}
}
//杩囨护缃戝墿浣欓噺
- else if (data.key == "filter_remain")
+ else if (data.key == FunctionAttributeKey.FilterRemain)
{
if (data.state != string.Empty)
{
this.airFreshData.Filter_remain = Convert.ToInt32(data.state);
+ }
+ }
+ //杩囨护缃戞槸鍚﹁秴鏃惰鍛�
+ else if (data.key == FunctionAttributeKey.FilterTimeout)
+ {
+ if(data.state != string.Empty)
+ {
+ this.airFreshData.Filter_timeout = Convert.ToBoolean(data.state);
}
}
}
@@ -658,6 +924,10 @@
/// 鍓╀綑婊ょ綉(%)
/// </summary>
public int Filter_remain = 0;
+ /// <summary>
+ /// 杩囨护缃戞槸鍚﹁秴鏃惰鍛�
+ /// </summary>
+ public bool Filter_timeout = false;
}
#endregion
--
Gitblit v1.8.0