From 271c46f52e74845dac76fa5ece4eb8b94d9168f4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 08 四月 2022 10:12:31 +0800 Subject: [PATCH] 金茂温控器 --- HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs | 545 ++++------------------------------------------------- 1 files changed, 48 insertions(+), 497 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs index b085c79..7683c79 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs @@ -37,10 +37,6 @@ /// </summary> Button btnMode; /// <summary> - /// 鎵鎸夐挳 - /// </summary> - Button btnSwing; - /// <summary> /// 椋庨�熸寜閽� /// </summary> Button btnWindSpeed; @@ -118,6 +114,17 @@ /// </summary> private void InitFrameWhiteContent1() { + Button btnJinmaoIcon = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(94), + Width = Application.GetRealWidth(164), + Height = Application.GetRealHeight(43), + UnSelectedImagePath = "FunctionIcon/CAC/JinMaoIcon.png" + }; + FrameWhiteCentet1.AddChidren(btnJinmaoIcon); + + temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")); arcBar = new DiyArcSeekBar() { @@ -183,7 +190,7 @@ Y = btnTemp.Bottom, Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(20), - Text = Language.StringByID(StringId.IndoorTemp) + "20掳C", + Text = Language.StringByID(StringId.IndoorTemp) + "20掳C/" + Language.StringByID(StringId.Humidity) +"45%", TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; @@ -215,34 +222,45 @@ Y = Application.GetRealHeight(334), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)), + UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode),true), }; FrameWhiteCentet1.AddChidren(btnMode); - - btnSwing = new Button() + Button btnModeText = new Button() { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(330), - Width = Application.GetRealWidth(40), - Height = Application.GetRealWidth(40), - UnSelectedImagePath = "FunctionIcon/AC/SweepIconNullOn.png", + X = Application.GetRealWidth(30), + Y = btnMode.Bottom, + Width = Application.GetRealWidth(90), + Height = Application.GetRealHeight(20), + TextAlignment = TextAlignment.Center, + TextSize = 12, + TextColor = CSS_Color.TextualColor, + TextID = StringId.Mode }; - if (device.GetAttribute(FunctionAttributeKey.Swing) != null) - { - FrameWhiteCentet1.AddChidren(btnSwing); - } - + FrameWhiteCentet1.AddChidren(btnModeText); btnWindSpeed = new Button() { - X = Application.GetRealWidth(235), - Y = Application.GetRealHeight(337), - Width = Application.GetRealWidth(30), - Height = Application.GetRealWidth(30), - UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)), + X = Application.GetRealWidth(238), + Y = Application.GetRealHeight(333), + Width = Application.GetRealWidth(38), + Height = Application.GetRealWidth(38), + UnSelectedImagePath = "FunctionIcon/CAC/DataIcon.png", }; FrameWhiteCentet1.AddChidren(btnWindSpeed); + + Button btnDataText = new Button() + { + X = Application.GetRealWidth(215), + Y = btnWindSpeed.Bottom, + Width = Application.GetRealWidth(90), + Height = Application.GetRealHeight(20), + TextAlignment = TextAlignment.Center, + TextSize = 12, + TextColor = CSS_Color.TextualColor, + TextID = StringId.Data + }; + FrameWhiteCentet1.AddChidren(btnDataText); btnSwitch = new Button() { @@ -259,7 +277,6 @@ LoadEvent_TempChange(); LoadEvent_AcStatesChange(); - LoadDiv_IrView(); } /// <summary> @@ -397,456 +414,6 @@ dialog.Show(); } - /// <summary> - /// 鍔犺浇淇敼鎵妯″紡鍖哄煙 - /// </summary> - void LoadDiv_ChangeSwingView() - { - Dialog dialog = new Dialog(); - - FrameLayout dialogView = new FrameLayout() - { - BackgroundColor = CSS_Color.DialogTransparentColor1, - }; - dialog.AddChidren(dialogView); - - FrameLayout modeChangeView; - modeChangeView = new FrameLayout() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(128), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(287), - BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", - }; - dialogView.AddChidren(modeChangeView); - - Button btnTitle; - btnTitle = new Button() - { - X = Application.GetRealWidth(8 + 16), - Y = Application.GetRealHeight(8), - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(44), - TextID = StringId.Swing, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.EmphasisFontSize_Secondary, - }; - modeChangeView.AddChidren(btnTitle); - - Button btnLine = new Button() - { - X = btnTitle.X, - Y = btnTitle.Bottom, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS_Color.BackgroundColor, - }; - modeChangeView.AddChidren(btnLine); - - var modeList = device.GetAttribute(FunctionAttributeKey.Swing).value; - foreach (var m in modeList) - { - Button btnModeIcon = new Button() - { - X = btnTitle.X, - Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), - Width = Application.GetRealWidth(24), - Height = Application.GetRealWidth(24), - IsSelected = device.GetAttrState(FunctionAttributeKey.Swing) == m, - }; - modeChangeView.AddChidren(btnModeIcon); - - Button btnModeText = new Button() - { - X = Application.GetRealWidth(12) + btnModeIcon.Right, - Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(90), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - IsSelected = device.GetAttrState(FunctionAttributeKey.Swing) == m, - TextSize = CSS_FontSize.TextFontSize, - }; - modeChangeView.AddChidren(btnModeText); - - if (modeList.IndexOf(m) < modeList.Count - 1) - { - modeChangeView.AddChidren(new Button() - { - X = btnTitle.X, - Y = btnModeText.Bottom, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS_Color.BackgroundColor, - }); - } - - btnModeIcon.UnSelectedImagePath = acFunction.GetSwingIconPath(m, false); - btnModeIcon.SelectedImagePath = acFunction.GetSwingIconPath(m); - btnModeText.Text = acFunction.GetSwingAttrText(m); - - EventHandler<MouseEventArgs> eventHandler = (sender, e) => - { - dialog.Close(); - }; - EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => - { - //if (!device.online) - //{ - // new Tip() - // { - // CloseTime = 1, - // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - // Direction = AMPopTipDirection.None, - // }.Show(MainPage.BaseView); - //} - btnModeIcon.IsSelected = btnModeText.IsSelected = true; - device.SetAttrState(FunctionAttributeKey.Swing, m); - btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(m); - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Swing, m); - Control.Ins.SendWriteCommand(device, d); - dialog.Close(); - }; - btnModeIcon.MouseUpEventHandler = eventHandler1; - btnModeText.MouseUpEventHandler = eventHandler1; - dialogView.MouseUpEventHandler = eventHandler; - - } - - dialogView.MouseUpEventHandler = (sender, e) => { - dialog.Close(); - }; - dialog.Show(); - } - /// <summary> - /// 鍔犺浇淇敼妯″紡鍖哄煙 - /// </summary> - void LoadDiv_ChangeFanView() - { - Dialog dialog = new Dialog(); - - FrameLayout dialogView = new FrameLayout() - { - BackgroundColor = CSS_Color.DialogTransparentColor1, - }; - dialog.AddChidren(dialogView); - - FrameLayout modeChangeView; - modeChangeView = new FrameLayout() - { - X = Application.GetRealWidth(185), - Y = Application.GetRealHeight(172), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(243), - BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", - }; - dialogView.AddChidren(modeChangeView); - - Button btnTitle; - btnTitle = new Button() - { - X = Application.GetRealWidth(8 + 16), - Y = Application.GetRealHeight(8), - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(44), - TextID = StringId.ChooseFan, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.EmphasisFontSize_Secondary, - }; - modeChangeView.AddChidren(btnTitle); - - Button btnLine = new Button() - { - X = btnTitle.X, - Y = btnTitle.Bottom, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS_Color.BackgroundColor, - }; - modeChangeView.AddChidren(btnLine); - - var modeList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value; - foreach (var m in modeList) - { - Button btnFanIcon = new Button() - { - X = btnTitle.X, - Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), - Width = Application.GetRealWidth(24), - Height = Application.GetRealWidth(24), - IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, - }; - modeChangeView.AddChidren(btnFanIcon); - - Button btnFanText = new Button() - { - X = Application.GetRealWidth(12) + btnFanIcon.Right, - Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(70), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, - TextSize = CSS_FontSize.TextFontSize, - }; - modeChangeView.AddChidren(btnFanText); - btnFanIcon.UnSelectedImagePath = acFunction.GetFanIconPath(m, false); - btnFanIcon.SelectedImagePath = acFunction.GetFanIconPath(m); - btnFanText.Text = acFunction.GetFanAttrText(m); - - if (modeList.IndexOf(m) < modeList.Count - 1) - { - modeChangeView.AddChidren(new Button() - { - X = btnTitle.X, - Y = btnFanText.Bottom, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS_Color.BackgroundColor, - }); - } - - EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => - { - dialog.Close(); - }; - EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => - { - //if (!device.online) - //{ - // new Tip() - // { - // CloseTime = 1, - // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - // Direction = AMPopTipDirection.None, - // }.Show(MainPage.BaseView); - //} - btnFanIcon.IsSelected = btnFanText.IsSelected = true; - 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(device, d); - //btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; - dialog.Close(); - }; - btnFanIcon.MouseUpEventHandler = eventHandler1; - btnFanText.MouseUpEventHandler = eventHandler1; - dialogView.MouseUpEventHandler = closeDialogEvent; - } - - dialog.Show(); - } - - /// <summary> - /// 鍔犺浇绾㈠閬ユ帶鍣紝棰濆鎸夐挳 - /// </summary> - void LoadDiv_IrView() - { - if (device.spk == SPK.AcIr) - { - var btnMore = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(334 + 80), - Width = Application.GetRealWidth(35), - Height = Application.GetRealWidth(35), - UnSelectedImagePath = "FunctionIcon/AC/More.png", - }; - FrameWhiteCentet1.AddChidren(btnMore); - - btnMore.MouseUpEventHandler = (sender, e) => { - LoadDialog_IrMoreView(); - }; - } - } - - /// <summary> - /// 鍔犺浇棰濆瀵圭孩澶栨寜閽晫闈� - /// </summary> - void LoadDialog_IrMoreView() - { - Dialog dialog = new Dialog(); - - var div = new FrameLayout(); - dialog.AddChidren(div); - div.MouseUpEventHandler = (sender, e) => { - dialog.Close(); - }; - - var bodyView = new FrameLayout() - { - Y = Application.GetRealHeight(427),//667 - Height = Application.GetRealHeight(240), - BackgroundColor = CSS_Color.MainBackgroundColor, - }; - div.AddChidren(bodyView); - - var contentView = new VerticalScrolViewLayout() - { - Y = Application.GetRealHeight(16), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(296 + 200), - }; - bodyView.AddChidren(contentView); - - - var row = new FrameLayout() - { - Height = Application.GetRealHeight(60), - Width = Application.GetRealWidth(296), - Gravity = Gravity.CenterHorizontal, - }; - contentView.AddChidren(row); - - int index = 0; - List<FunctionAttributes> attrList = new List<FunctionAttributes>(); - attrList.AddRange(device.attributes); - attrList.Add(new FunctionAttributes() - { - key = "+", - }); - - foreach (var attr in attrList) - { - if (attr.key == FunctionAttributeKey.Mode - || attr.key == FunctionAttributeKey.OnOff - || attr.key == FunctionAttributeKey.SetTemp - || attr.key == FunctionAttributeKey.SetTempStep - || attr.key == FunctionAttributeKey.FanSpeed - || attr.key == FunctionAttributeKey.FanManual - || attr.key == FunctionAttributeKey.FanAuto - ) - { - continue; - } - if (index != 0 && index % 3 == 0) - { - row = new FrameLayout() - { - Height = Application.GetRealHeight(56), - Width = Application.GetRealWidth(296), - Gravity = Gravity.CenterHorizontal, - }; - contentView.AddChidren(row); - } - if (attr.key == "+") - { - var addView = new FrameLayout() - { - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(88), - Height = Application.GetRealHeight(40), - Radius = (uint)Application.GetRealHeight(18), - BorderColor = CSS_Color.PromptingColor1, - BorderWidth = (uint)Application.GetRealWidth(2), - }; - - - if (index % 3 == 1) - { - addView.Gravity = Gravity.Center; - } - else if (index % 3 == 2) - { - addView.X = Application.GetRealWidth(208); - } - row.AddChidren(addView); - - var btnAdd = new Button() - { - Gravity = Gravity.Center, - UnSelectedImagePath = "Public/PlusSignIcon.png", - Width = Application.GetRealWidth(32), - Height = Application.GetRealWidth(32), - }; - addView.AddChidren(btnAdd); - - btnAdd.MouseUpEventHandler = (sender, e) => - { - dialog.Close(); - Action action = () => { - LoadDialog_IrMoreView(); - }; - var addButton = new AcControlPage_AddIrButton(action); - MainPage.BasePageView.AddChidren(addButton); - addButton.Show(device); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - - - } - else - { - - var btn = new Button() - { - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(88), - Height = Application.GetRealHeight(40), - Radius = (uint)Application.GetRealHeight(18), - BorderColor = CSS_Color.PromptingColor1, - BorderWidth = (uint)Application.GetRealWidth(2), - TextAlignment = TextAlignment.Center, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainBackgroundColor, - SelectedBackgroundColor = CSS_Color.MainColor, - }; - if (attr.value.Count > 0) - { - btn.Text = attr.value[0]; - } - if (index % 3 == 1) - { - btn.Gravity = Gravity.Center; - } - else if (index % 3 == 2) - { - btn.X = Application.GetRealWidth(208); - } - row.AddChidren(btn); - - btn.MouseUpEventHandler = (sender, e) => - { - //if (!device.online) - //{ - // new Tip() - // { - // CloseTime = 1, - // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - // Direction = AMPopTipDirection.None, - // }.Show(MainPage.BaseView); - //} - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(attr.key, ""); - Control.Ins.SendWriteCommand(device, d); - - new System.Threading.Thread(() => - { - System.Threading.Thread.Sleep(2000); - Application.RunOnMainThread(() => - { - btn.IsSelected = false; - }); - }) - { IsBackground = true }.Start(); - }; - - } - - index++; - } - - dialog.Show(); - } - #endregion @@ -975,22 +542,12 @@ } LoadDiv_ChangeModeView(); }; - //鎵鏀瑰彉妯″紡 - btnSwing.MouseUpEventHandler = (sender, e) => - { - if (device.trait_on_off.curValue.ToString() == "off") - { - return; - } - LoadDiv_ChangeSwingView(); - }; btnWindSpeed.MouseUpEventHandler = (sender, e) => { - if (device.trait_on_off.curValue.ToString() == "off") - { - return; - } - LoadDiv_ChangeFanView(); + var page = new CacHistoryChoosePage(device); + MainPage.BasePageView.AddChidren(page); + page.InitView(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnSwitch.MouseUpEventHandler = (sender, e) => @@ -1042,13 +599,9 @@ } else { - btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "掳C"; - btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); - btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing)); - btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); - btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode), false); - btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing), false); - btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed), false); + btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "掳C" + + Language.StringByID(StringId.Humidity) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", "."))) + "%"; + btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."))); @@ -1057,7 +610,6 @@ if (device.trait_on_off.curValue.ToString() == "on") { - btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true; arcBar.IsOffline = false; btnSwitch.IsSelected = true; arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; @@ -1072,7 +624,6 @@ } else { - btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = false; arcBar.IsOffline = true; btnSwitch.IsSelected = false; arcBar.IsClickable = false; -- Gitblit v1.8.0