From 0b5b6ec781a8cb3400ad34693792bad07e97a00c Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 30 六月 2022 09:32:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/release0123' into wjc --- HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 162 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs index b05b80e..100e277 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs @@ -36,6 +36,11 @@ /// </summary> Button btnMode; /// <summary> + /// 宸ヤ綔妯″紡鎸夐挳 + /// </summary> + Button btnWrokMode; + + /// <summary> /// 寮�鍏虫寜閽� /// </summary> Button btnSwitch; @@ -172,6 +177,25 @@ }; FrameWhiteCentet1.AddChidren(btnPlus); + if (device.GetAttribute("mode_work") != null) + { + btnWrokMode = new Button() + { + X = Application.GetRealWidth(60), + Y = Application.GetRealHeight(334), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + UnSelectedImagePath = fhTemp.GetWrokModeIconPath(device.GetAttrState("mode_work")), + }; + FrameWhiteCentet1.AddChidren(btnWrokMode); + if (device.GetAttribute("mode_work").value.Count > 1) + { + btnMode.MouseUpEventHandler = (sender, e) => + { + LoadDiv_ChangeModeView(); + }; + } + } if (device.GetAttribute(FunctionAttributeKey.Mode) != null) { btnMode = new Button() @@ -208,6 +232,135 @@ LoadEvent_AcStatesChange(); } + + + /// <summary> + /// 鍔犺浇淇敼妯″紡鍖哄煙 + /// </summary> + void LoadDiv_ChangeWorkModeView() + { + Dialog dialog = new Dialog(); + + FrameLayout dialogView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(dialogView); + + FrameLayout modeChangeView; + modeChangeView = new FrameLayout() + { + X = Application.GetRealWidth(30), + Y = Application.GetRealHeight(128), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(287), + BackgroundImagePath = "FunctionIcon/AC/DivBg1.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.ChooseMode, + 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.WorkMode).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.WorkMode) == 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.Mode) == m, + TextSize = CSS_FontSize.TextFontSize, + }; + modeChangeView.AddChidren(btnModeText); + + btnModeIcon.UnSelectedImagePath = fhTemp.GetModeIconPath(m, false); + btnModeIcon.SelectedImagePath = fhTemp.GetModeIconPath(m); + btnModeText.Text = fhTemp.GetModeAttrText(m); + + 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, + }); + } + 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.WorkMode, m); + btnMode.UnSelectedImagePath = fhTemp.GetWrokModeIconPath(m); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; + d.Add(FunctionAttributeKey.WorkMode, 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> /// 鍔犺浇淇敼妯″紡鍖哄煙 @@ -525,6 +678,15 @@ arcBar.IsClickable = false; arcBar.IsOffline = true; } + + if(btnWrokMode!=null){ + var dd = device.GetAttrState("mode_work"); + if (dd != "0") + { + btnWrokMode.UnSelectedImagePath = fhTemp.GetWrokModeIconPath(dd); + } + } + }); } -- Gitblit v1.8.0