陈嘉乐
2021-01-27 122dc4312c72b2d2aaa50a2adf84165f5600b99a
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -9,7 +9,7 @@
    public class MainView
    {
        /// <summary>
        /// 记录逻辑自动化父控件
        /// VerticalRefreshLayout父控件
        /// </summary>
        public static FrameLayout automationPage;
        /// <summary>
@@ -34,7 +34,7 @@
            };
            //获取自动化列表
            GetLogicList();
             for (int i = Logic.LogicList.Count-1; i >= 0; i--)//降序排列
            for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列
            //for (int i = 0; i < Logic.LogicList.Count; i++)
            {
                var currLogic = Logic.LogicList[i];
@@ -76,12 +76,12 @@
                        }
                        catch { }
                    })
                    { IsBackground = true }.Start();
                };
                GetSelectIcon(logicView.frameLayout, currLogic);
                if (i==0)//降序排列
                if (i == 0)//降序排列
                //if (Logic.LogicList.Count - 1 == i)
                {
                    ///最后一个距离最底部12,界面显示效果作用;
@@ -135,7 +135,7 @@
        ///返回循环描述文本
        /// </summary>
        /// <param name="logic"></param>
        public static string GetCyclicText(Logic logic)
        public static string GetCyclicText(Logic logic)
        {
            string weekName = "";
@@ -233,7 +233,6 @@
        /// </summary>
        public static void GetLogicList()
        {
            if (Logic.LogicList.Count != 0)
            {
                //自动化列表为0才去获取自动化列表;
@@ -270,8 +269,38 @@
                        var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId);
                        if (if_logic == null)
                        {
                            Logic newlogic = new Logic();
                            newlogic.name = logic.name;
                            newlogic.userLogicId = logic.userLogicId;
                            newlogic.sid = logic.sid;
                            newlogic.relation = logic.relation;
                            newlogic.enable = logic.enable;
                            newlogic.cycle = logic.cycle;
                            for (int i = 0; i < logic.input.Count; i++)
                            {
                                if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
                                {
                                    //防止调试软件乱传东西上来;
                                    //防止有空对象;
                                    //正常情况下不会出现的现象;
                                    continue;
                                }
                                newlogic.input.Add(logic.input[i]);
                            }
                            for (int i = 0; i < logic.output.Count; i++)
                            {
                                if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
                                {
                                    //防止调试软件乱传东西上来;
                                    //防止有空对象;
                                    //正常情况下不会该现象;
                                    continue;
                                }
                                newlogic.output.Add(logic.output[i]);
                            }
                            //添加逻辑
                            Logic.LogicList.Add(logic);
                            Logic.LogicList.Add(newlogic);
                        }
                    }
@@ -299,7 +328,7 @@
        /// 显示条件或者目标类型图标
        /// </summary>
        /// <param name="layouFrame">父控件</param>
        /// <param name="logic">当前逻辑</param>
        /// <param name="logic">当前自动化</param>
        private static void GetSelectIcon(FrameLayout layouFrame, Logic logic)
        {
@@ -312,12 +341,6 @@
            //2-功能图标
            for (int i = 0; i < logic.input.Count; i++)
            {
                if (logic.input[i] == null)
                {
                    //防止有的空对象;
                    //正常情况下不会该现象;
                    continue;
                }
                var int1 = int.Parse(logic.input[i].condition_type);
                int iconInt = 0;
@@ -354,12 +377,6 @@
            //14-延时图标
            for (int i = 0; i < logic.output.Count; i++)
            {
                if (logic.output[i] == null)
                {
                    //防止有的空对象;
                    //正常情况下不会该现象;
                    continue;
                }
                var int1 = int.Parse(logic.output[i].target_type);
                int iconInt = 0;
                switch (int1)
@@ -390,10 +407,11 @@
                }
            }
            //图标控件的父控件
            FrameLayout frame = new FrameLayout {
                Height=Application.GetRealHeight(40),
                Width=Application.GetRealWidth(275),
                Y= Application.GetRealHeight(56),
            FrameLayout frame = new FrameLayout
            {
                Height = Application.GetRealHeight(40),
                Width = Application.GetRealWidth(275),
                Y = Application.GetRealHeight(56),
            };
            layouFrame.AddChidren(frame);
@@ -405,7 +423,7 @@
                {
                    Width = Application.GetRealWidth(28),
                    Height = Application.GetRealWidth(28),
                    Gravity=Gravity.CenterVertical,
                    Gravity = Gravity.CenterVertical,
                };
                frame.AddChidren(btnIcon);
@@ -415,12 +433,14 @@
                }
                else
                {
                    btnIcon.X = Application.GetRealWidth(12+(28+4)*i);
                    btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i);
                }
                string strIcon = "";
                switch (iconIntValue[i]) {
                    case 1: {
                switch (iconIntValue[i])
                {
                    case 1:
                        {
                            strIcon = "LogicIcon/selectTheTime.png";
                        }
                        break;
@@ -434,17 +454,21 @@
                        {
                            //分割条件和目标的图标
                            strIcon = "LogicIcon/link.png";
                        } break;
                        }
                        break;
                    case 12:
                        {
                            strIcon = "LogicIcon/selectTheFun.png";
                        }
                        break;
                    case 13: {
                    case 13:
                        {
                            strIcon = "LogicIcon/selectTheScene.png";
                        } break;
                    case 14: {
                        }
                        break;
                    case 14:
                        {
                            //strIcon = "LogicIcon/timeicon.png";
                        }
                        break;
@@ -460,12 +484,21 @@
        /// 云端唯一id
        /// </summary>
        public string userLogicId = "";
        /// <summary>
        /// 网关id
        /// </summary>
        public string gatewayId = "";
        /// <summary>
        /// 逻辑唯一标识
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 逻辑名称
        /// </summary>
        public string name = "";
        /// <summary>
        /// 逻辑使能(开,关)
        /// </summary>
        public string enable = "";
        //public CycleA cycle;
        //public string modifyTime = "";