From 489d3bd60ad7dc2fecb398b09cf4c52df16f0fc2 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 26 七月 2023 15:55:30 +0800 Subject: [PATCH] Merge branch 'Dev-Branch' of http://59.41.255.150:6688/r/~wxr/OnPro into Dev-Branch --- HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs | 184 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 184 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs b/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs new file mode 100644 index 0000000..e9b11a2 --- /dev/null +++ b/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs @@ -0,0 +1,184 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI.UI2.Classification +{ + /// <summary> + /// 璺戦┈鐏〉闈� + /// 搴忓垪椤甸潰 + /// </summary> + public class SeriesFunctionListPage : FrameLayout + { + FrameLayout bodyView; + public SeriesFunctionListPage() + { + bodyView = this; + } + + public void LoadPage() + { + new TopViewDiv(bodyView, Language.StringByID(StringId.HorseRaceLamp)).LoadTopView(); + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + + var functionListView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(603 - 12), + }; + bodyView.AddChidren(functionListView); + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Hide(); + + Dictionary<string, List<Button>> dicGroupButtons = new Dictionary<string, List<Button>>(); + + List<string> oidList = new List<string>(); + + foreach(var rgb in FunctionList.List.GetLightList()) + { + //if(rgb.spk == SPK.LightRGB) + { + var oid = rgb.sid.Substring(0, 16); + if (oidList.Contains(oid)) + { + continue; + } + var seriesList = FunctionList.List.GetSeries().FindAll((obj) => obj.sid.StartsWith(oid)); + if (seriesList.Count == 0) + { + continue; + } + oidList.Add(oid); + var list = new List<Function>(); + List<Button> groupButtons = new List<Button>(); + list.AddRange(seriesList); + var groupView = new VerticalScrolViewLayout() + { + Height = Application.GetRealHeight(44 + 51 * list.Count), + BackgroundColor = CSS_Color.MainBackgroundColor, + ScrollEnabled = false, + }; + functionListView.AddChidren(groupView); + + #region title + var titleView = new FrameLayout() + { + Height = Application.GetRealHeight(44), + }; + groupView.AddChidren(titleView); + + var btnTitle = new Button() + { + X = Application.GetRealWidth(16), + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.MainColor, + Text =Language.StringByID( StringId.HorseRaceLampGroup )+ " "+ oidList.Count.ToString(), + }; + if(Language.CurrentLanguage == "Chinese") + { + btnTitle.Text = Language.StringByID(StringId.HorseRaceLampGroup) + oidList.Count.ToString(); + } + titleView.AddChidren(btnTitle); + + #endregion + + foreach (var series in list) + { + groupView.AddChidren(new Button + { + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor, + }); + + var rgbColorfulView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + }; + groupView.AddChidren(rgbColorfulView); + + var btnRgbColorfulTitle = new Button() + { + X = Application.GetRealWidth(16), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = series.name == rgb.name ? Language.StringByID(StringId.AutomaticColoring) : series.name, + }; + rgbColorfulView.AddChidren(btnRgbColorfulTitle); + + var btnColorfulSwitch = new Button() + { + X = Application.GetRealWidth(320), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(48), + Height = Application.GetMinRealAverage(36), + UnSelectedImagePath = "Public/Switch.png", + SelectedImagePath = "Public/SwitchOn.png", + Tag = series.sid, + }; + rgbColorfulView.AddChidren(btnColorfulSwitch); + + groupButtons.Add(btnColorfulSwitch); + + btnColorfulSwitch.MouseUpEventHandler = (sener, e) => { + btnColorfulSwitch.IsSelected = !btnColorfulSwitch.IsSelected; + var state = btnColorfulSwitch.IsSelected ? "on" : "off"; + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var d = new Dictionary<string, string>(); + d.Add("on_off", state); + DriverLayer.Control.Ins.SendWriteCommand(series, d); + if (state == "on") + { + Application.RunOnMainThread(() => + { + List<Button> updataList = new List<Button>(); + dicGroupButtons.TryGetValue(((Button)sener).Tag.ToString().Substring(0, 16), out updataList); + foreach (var updataTemp in updataList) + { + updataTemp.IsSelected = false; + } + btnColorfulSwitch.IsSelected = true; + }); + } + } + catch (Exception ex) + { + MainPage.Log($"搴忓垪鎺у埗寮傚父锛歿ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + }; + + + } + Console.WriteLine("oid: " + oid); + dicGroupButtons.TryAdd(oid, groupButtons); + + functionListView.AddChidren(new Button + { + Height = Application.GetRealHeight(8), + BackgroundColor = CSS_Color.DividingLineColor, + }); + + } + } + + } + + + } +} -- Gitblit v1.8.0