From 6b7a07bcbe147be7ed64994c40bcc5b0a2042aae Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 05 七月 2021 11:23:35 +0800 Subject: [PATCH] 代码合并-温居城 --- HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs | 235 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 207 insertions(+), 28 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs index b96c396..b6557c1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs @@ -46,7 +46,7 @@ #endregion #region 鍖哄煙鍙橀噺 - Function function; + Function device; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -59,7 +59,7 @@ public StbPage(Function func) { bodyView = this; - function = func; + device = func; } @@ -89,7 +89,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = function.name, + Text = device.name, }; controlView.AddChidren(btnFunctionName); @@ -102,7 +102,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = function.GetRoomListName() + Text = device.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -114,7 +114,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = function.collect + IsSelected = device.collect }; controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -322,6 +322,9 @@ UnSelectedImagePath = "FunctionIcon/AC/More.png", }; controlView.AddChidren(btnMore); + btnMore.MouseUpEventHandler = (sender, e) => { + LoadDialog_IrMoreView(); + }; btnPower = new Button() { @@ -337,8 +340,8 @@ LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.STB)).LoadTopView_FunctionTop(function, actionRefresh); - DriverLayer.Control.Ins.SendReadCommand(function); + new TopViewDiv(bodyView, Language.StringByID(StringId.STB)).LoadTopView_FunctionTop(device, actionRefresh); + Control.Ins.SendReadCommand(device); } @@ -426,7 +429,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add($"number_{index}", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btn.MouseDownEventHandler = (sender, e) => { @@ -449,9 +452,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = function.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); - function.UpdataFuncitonInfo(); + btnFunctionName.Text = btnFunctionName_Out.Text = device.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = device.GetRoomListName(); + device.UpdataFuncitonInfo(); }; } @@ -461,8 +464,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - function.CollectFunction(); + btnCollection.IsSelected = device.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + device.CollectFunction(); }; } @@ -477,7 +480,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("av_tv", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnChlPlus.MouseUpEventHandler = (sender, e) => @@ -486,7 +489,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("ch+", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnChlReduce.MouseUpEventHandler = (sender, e) => @@ -495,7 +498,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("ch-", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnVolPlus.MouseUpEventHandler = (sender, e) => @@ -504,7 +507,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("volume+", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnVolReduce.MouseUpEventHandler = (sender, e) => @@ -513,7 +516,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("volume-", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnBack.MouseUpEventHandler = (sender, e) => @@ -522,7 +525,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("return", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; @@ -532,7 +535,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("menu", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btn123.MouseUpEventHandler = (sender, e) => @@ -545,7 +548,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("mute", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnPower.MouseUpEventHandler = (sender, e) => @@ -554,7 +557,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("on_off", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; @@ -581,7 +584,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("menu", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnTopMenuUp.MouseUpEventHandler = (sender, e) => { @@ -590,7 +593,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("up", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnTopMenuLeft.MouseUpEventHandler = (sender, e) => { @@ -599,7 +602,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("left", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnTopMenuRight.MouseUpEventHandler = (sender, e) => { @@ -608,7 +611,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("right", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnTopMenuDown.MouseUpEventHandler = (sender, e) => { @@ -617,7 +620,7 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("down", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; btnOk.MouseUpEventHandler = (sender, e) => { @@ -626,12 +629,188 @@ { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("ok", ""); - Control.Ins.SendWriteCommand(function, d); + Control.Ins.SendWriteCommand(device, d); } }; } + + /// <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 == "up" + || attr.key == "down" + || attr.key == "right" + || attr.key == "left" + || attr.key == "zoom+" + || attr.key == "zoom-" + || attr.key == "volume+" + || attr.key == "volume-" + || attr.key == "back" + || attr.key == "menu" + || attr.key == FunctionAttributeKey.OnOff + ) + { + 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) => + { + 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(); + } + } } -- Gitblit v1.8.0