From 098c053cb132a432f4e3c342d26a3d71621c10dd Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 05 七月 2021 11:15:02 +0800 Subject: [PATCH] 性能优化:无状态功能开关点击反馈 --- HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 37 ++++- HDL_ON/Entity/Function/Function.cs | 7 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 65 -------- HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs | 2 .vs/HDL_APP_Project/xs/UserPrefs.xml | 37 +++- HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs | 235 +++++++++++++++++++++++++++++---- 9 files changed, 273 insertions(+), 114 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 39fadc2..d28de8c 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,6 +1,6 @@ -锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> +锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs"> <Files> <File FileName="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs" Line="15" Column="35" /> <File FileName="HDL_ON/Common/HDLCommon.cs" /> @@ -10,28 +10,41 @@ <File FileName="HDL_ON/UI/BindingResidence/BindingResidencePage.cs" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" /> + <File FileName="HDL-ON_iOS/Resources/Language.ini" Line="1" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" Line="11" Column="27" /> + <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="14" Column="78" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="87" Column="59" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="946" Column="53" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="406" Column="26" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="148" Column="49" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs" Line="341" Column="13" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs" Line="309" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> - <Node name="DAL" expanded="True"> - <Node name="Mqtt" expanded="True" /> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> </Node> - <Node name="Entity" expanded="True" /> <Node name="UI" expanded="True"> - <Node name="BindingResidence" expanded="True" /> + <Node name="UI0-Public" expanded="True" /> <Node name="UI2" expanded="True"> - <Node name="3-Intelligence" expanded="True"> - <Node name="Scene" expanded="True" /> + <Node name="1-HomePage" expanded="True" /> + <Node name="2-Classification" expanded="True" /> + <Node name="FuntionControlView" expanded="True"> + <Node name="Electrical" expanded="True"> + <Node name="PjtPage.cs" selected="True" /> + </Node> </Node> - <Node name="4-PersonalCenter" expanded="True" /> </Node> </Node> </Node> - <Node name="HDL-ON_Android" expanded="True" selected="True" /> - <Node name="HDL-ON_iOS" expanded="True" /> + <Node name="HDL-ON_Android" expanded="True" /> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="Resources" expanded="True" /> + </Node> </Node> </State> </Pad> @@ -43,7 +56,7 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore /> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 91adfe7..49768d5 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1336,7 +1336,6 @@ #endregion - #region 璁惧绫� /// <summary> /// 绾㈠瀹� @@ -1394,6 +1393,12 @@ } #endregion + /// <summary> + /// 娌℃湁鐘舵�佹樉绀虹殑鍔熻兘spk鍒楄〃 + /// </summary> + public static List<string> NotStatusSpkList = new List<string> { + ElectricTV, FanIr, TvIr, TvXmIr, StbIr, PjtIr, IrLearn + }; /// <summary> /// 绗笁鏂瑰搧鐗屽垪琛� diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index d58d0ec..63b97f5 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -948,12 +948,8 @@ LoadEvent_ControlCurtain(function, btnCurtainClose, btnCurtainOpen); } - else if (function.spk == SPK.ElectricTV || function.spk == SPK.TvIr || function.spk == SPK.TvXmIr - || function.spk == SPK.StbIr || function.spk == SPK.PjtIr) + else if (SPK.NotStatusSpkList.Contains(function.spk)) { - //btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; - //btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; - Button btnPower; btnPower = new Button() { @@ -962,6 +958,7 @@ Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PowerClose.png", + SelectedImagePath = "Public/PowerOpen.png", }; view.AddChidren(btnPower); LoadEvent_ControlTV(function, btnPower); @@ -1057,62 +1054,8 @@ }; view.AddChidren(btnSwitch); - btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; - - //switch (function.Spk_Prefix) - //{ - // //todo 澧炲姞璁惧锛屼富椤垫敹钘忓浘鏍� - // case FunctionCategory.Light: - // #region 鐏厜 Light - // btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightIcon.png"; - // btnIcon.SelectedImagePath = "FunctionIcon/Light/LightOnIcon.png"; - // UpdataFunctionStates(function); - // #endregion - // break; - // case FunctionCategory.AC: - // #region 绌鸿皟 AC - // btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; - // btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; - // #endregion - // break; - // case FunctionCategory.FloorHeat: - // #region 鍦扮儹 - // btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; - // btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; - // #endregion - // break; - // case FunctionCategory.Electric: - // switch (function.spk) - // { - // case SPK.ElectricSocket: - // btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketIcon.png"; - // btnIcon.SelectedImagePath = "FunctionIcon/Socket/SocketOnIcon.png"; - // break; - // case SPK.ElectricFan: - // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanIcon.png"; - // btnIcon.SelectedImagePath = "FunctionIcon/Electrical/FanOnIcon.png"; - // break; - // case SPK.ElectricTuyaAirCleaner: - // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIcon.png"; - // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIconOn.png"; - // break; - // case SPK.ElectricTuyaFan: - // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/FanIcon.png"; - // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/FanIconOn.png"; - // break; - // case SPK.ElectricTuyaWaterValve: - // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIcon.png"; - // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIconOn.png"; - // break; - // case SPK.ElectricTuyaWeepRobot: - // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIcon.png"; - // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIconOn.png"; - // break; - // } - // break; - //} LoadEvent_SwitchFunction(function, btnSwitch); } //鍙栨秷鏀惰棌浜嬩欢 @@ -1137,8 +1080,8 @@ btnName.MouseUpEventHandler = skipControlPageEvent; btnIcon.MouseUpEventHandler = skipControlPageEvent; btnState.MouseUpEventHandler = skipControlPageEvent; - //鐢佃涓嶉渶瑕佹洿鏂扮姸鎬� - if(function.spk!= SPK.ElectricTV && function.spk != SPK.StbIr && function.spk != SPK.PjtIr) + //涓嶉渶瑕佹洿鏂扮姸鎬佺殑鍔ㄨ兘鍒楄〃 + if(!SPK.NotStatusSpkList.Contains(function.spk)) { UpdataFunctionStates(function); } diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index b84b2a7..f0fdbc0 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -359,6 +359,13 @@ btnSwitch.IsSelected = !btnSwitch.IsSelected; new System.Threading.Thread(() => { + if(SPK.NotStatusSpkList.Contains(function.spk)) + { + System.Threading.Thread.Sleep(1000); + Application.RunOnMainThread(() => { + btnSwitch.IsSelected = !btnSwitch.IsSelected; + }); + } function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; Dictionary<string, string> d = new Dictionary<string, string>(); if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) @@ -388,21 +395,35 @@ /// <summary> /// 鍔犺浇鐢佃鎺у埗浜嬩欢 /// </summary> - /// <param name="tV"></param> - /// <param name="button"></param> - void LoadEvent_ControlTV(Function tV, Button button) + /// <param name="function"></param> + /// <param name="btnSwitch"></param> + void LoadEvent_ControlTV(Function function, Button btnSwitch) { - button.MouseUpEventHandler = (sender, e) => + btnSwitch.MouseUpEventHandler = (sender, e) => { if (DB_ResidenceData.Instance.GatewayType == 1) { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", ""); - Control.Ins.SendWriteCommand(tV, d); + btnSwitch.IsSelected = !btnSwitch.IsSelected; + new System.Threading.Thread(() => + { + if (SPK.NotStatusSpkList.Contains(function.spk)) + { + System.Threading.Thread.Sleep(2000); + Application.RunOnMainThread(() => + { + btnSwitch.IsSelected = !btnSwitch.IsSelected; + }); + } + + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("on_off", ""); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); } else { - new TV().ControlTV(InfraredCode_TV.Power, tV); + new TV().ControlTV(InfraredCode_TV.Power, function); } }; } diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index ba7121f..27ce249 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -160,7 +160,6 @@ LoadLastStatesButton(); break; case FunctionCategory.Light: - //btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; LoadLightControl(); break; diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs index 6f234d8..66a2ff8 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -81,7 +81,7 @@ { btnSwitch.IsSelected = !btnSwitch.IsSelected; - if(function.spk == SPK.IrLearn || function.spk == SPK.TvIr || function.spk == SPK.TvXmIr) + if(SPK.NotStatusSpkList.Contains( function.spk )) { new System.Threading.Thread(() => { System.Threading.Thread.Sleep(2000); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs index 5a653c0..3cc7993 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs @@ -44,7 +44,7 @@ Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(88), Width = Application.GetRealWidth(134), - Height = Application.GetRealHeight(134), + Height = Application.GetRealWidth(134), UnSelectedImagePath = "FunctionIcon/IrFan/FanIcon.png", }; FrameWhiteCentet1.AddChidren(btnIcon); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs index 523142c..7b051bd 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs @@ -47,7 +47,6 @@ #endregion #region 鍖哄煙鍙橀噺 - //TV tvTemp = new TV(); Function device; Button btnCollection_Out; Button btnFunctionName_Out; 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