mac
2023-08-29 2d5cd35af7437ad4015d38594d8c721dc6166b11
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs
@@ -26,10 +26,58 @@
            };
            bodyView.AddChidren(contentView);
            #region 找出所有序列的oid
            List<string> oidList = new List<string>();
            foreach (var rgb in list)
            {
                var oid = rgb.sid.Substring(0, 16);
                if (!oidList.Contains(oid))
                {
                    oidList.Add(oid);
                }
            }
            var seriesList = FunctionList.List.GetSeries();
            foreach(var rgb in list)
            foreach(var temp in seriesList)
            {
                var oid = temp.sid.Substring(0, 16);
                if (!oidList.Contains(oid))
                {
                    oidList.Add(oid);
                }
            }
            #endregion
            //Dictionary<string, List<string>> deviceList = new Dictionary<string, List<string>>();
            //foreach(var oid in oidList)
            //{
            //    var sidList = FunctionList.List.
            //    if (!deviceList.ContainsKey(oid))
            //    {
            //        deviceList.Add(oid)
            //    }
            //}
            foreach(var oid in oidList)
            {
                Function rgb = null;
                rgb = list.Find((obj) => obj.sid.Substring(0, 16) == oid);
                if(rgb == null)
                {
                    rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightRGB && obj.sid.Substring(0, 16) == oid);
                    if (rgb == null)
                    {
                        rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightCCT && obj.sid.Substring(0, 16) == oid);
                        if (rgb == null)
                        {
                            rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightDimming && obj.sid.Substring(0, 16) == oid);
                        }
                    }
                }
                var titleView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(44),
@@ -49,37 +97,40 @@
                };
                titleView.AddChidren(btnViewTitle);
                var autoColorfulView = new FrameLayout()
                if (rgb.GetAttribute(FunctionAttributeKey.Colorful) != null)
                {
                    Height = Application.GetRealHeight(44),
                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                };
                contentView.AddChidren(autoColorfulView);
                autoColorfulView.AddChidren(new Button() { Width = Application.GetRealWidth(343), Gravity = Gravity.BottomCenter, Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor, Y = Application.GetRealHeight(44) - 1 });
                    var autoColorfulView = new FrameLayout()
                    {
                        Height = Application.GetRealHeight(44),
                        BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                    };
                    contentView.AddChidren(autoColorfulView);
                    autoColorfulView.AddChidren(new Button() { Width = Application.GetRealWidth(343), Gravity = Gravity.BottomCenter, Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor, Y = Application.GetRealHeight(44) - 1 });
                Button btnAutoColorfulRight = new Button()
                {
                    X = Application.GetRealWidth(339),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/Right.png",
                };
                autoColorfulView.AddChidren(btnAutoColorfulRight);
                    Button btnAutoColorfulRight = new Button()
                    {
                        X = Application.GetRealWidth(339),
                        Gravity = Gravity.CenterVertical,
                        Width = Application.GetMinRealAverage(16),
                        Height = Application.GetMinRealAverage(16),
                        UnSelectedImagePath = "Public/Right.png",
                    };
                    autoColorfulView.AddChidren(btnAutoColorfulRight);
                var btnAutoColorfulTitle = new Button()
                {
                    X = Application.GetRealWidth(16),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = CSS.CSS_FontSize.TextFontSize,
                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                    TextID = StringId.Auto,
                };
                autoColorfulView.AddChidren(btnAutoColorfulTitle);
                btnAutoColorfulTitle.MouseUpEventHandler = (sender, e) =>
                {
                    LoadEditDialog_OnOff(rgb.sid,true);
                };
                    var btnAutoColorfulTitle = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextSize = CSS.CSS_FontSize.TextFontSize,
                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                        TextID = StringId.Auto,
                    };
                    autoColorfulView.AddChidren(btnAutoColorfulTitle);
                    btnAutoColorfulTitle.MouseUpEventHandler = (sender, e) =>
                    {
                        LoadEditDialog_OnOff(rgb.sid, true);
                    };
                }
                var rgbSeriesList = seriesList.FindAll((obj) => obj.sid.Substring(0, 16) == rgb.sid.Substring(0, 16));
                foreach(var rgbSeries in rgbSeriesList)
@@ -252,6 +303,10 @@
                Output outputDevice = new Output();
                outputDevice.target_type = "1";
                outputDevice.sid = sid;
                outputDevice.delay = "0";
                List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>();
                Dictionary<string, string> diction = new Dictionary<string, string>();
@@ -268,10 +323,16 @@
                outputDevice.status = dicSateteList;
                var oldTemp = Logic.currlogic.output.Find((obj) => obj.sid.Substring(0, 16) == sid.Substring(0, 16));
                if (oldTemp != null)
                try
                {
                    Logic.currlogic.output.Remove(oldTemp);
                    var oldTemp = Logic.currlogic.output.Find((obj) => obj.sid != null && obj.sid.Length > 16 && obj.sid.Substring(0, 16) == sid.Substring(0, 16));
                    if (oldTemp != null)
                    {
                        Logic.currlogic.output.Remove(oldTemp);
                    }
                }catch(Exception ex)
                {
                    MainPage.Log($"自动化保存跑马灯数据异常:{ex.Message}");
                }
                Logic.currlogic.output.Add(outputDevice);