wei
2021-01-11 41f9c8837b0551c68f8fd798c06951fa716b7ab8
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
old mode 100755 new mode 100644
@@ -253,6 +253,143 @@
        }
        /// <summary>
        /// 超出5个元素该用滑动控件
        /// </summary>
        /// <param name="frame">显示在哪个界面的父控件</param>
        /// <param name="list">显示数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值索引值</param>
        public void FrameOrVv(FrameLayout frame, List<string>list, int titleText,Action<int> action) {
            int line = 0;
            if (list.Count == 0 || list.Count > 5)
            {
                //超出5个只能默认5个;
                line = 5;
            }
            else
            {
                line = list.Count;
            }
            FrameLayout frameLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            frame.AddChidren(frameLayout);
            LogicView.DateView view = new LogicView.DateView();
            view.btnTitle.TextID = titleText;
            view.FLayoutView(frameLayout, line);
            view.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
            //小于5使用
            FrameLayout frameL = new FrameLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * line),
            };
            //大于5使用
            VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * 5),
            };
            verticalRefresh.BeginHeaderRefreshingAction += () =>
            {
                //关闭刷新View;
                verticalRefresh.EndHeaderRefreshing();
            };
            if (list.Count == 0)
            {
                Button btnTipNot = new Button
                {
                    X = Application.GetRealWidth(93),
                    Y = Application.GetRealHeight(80),
                    Width = Application.GetRealWidth(158),
                    Height = Application.GetRealWidth(158),
                    UnSelectedImagePath = "TipNot.png",
                };
                view.frameLayout.AddChidren(btnTipNot);
                Button btnTipNotText = new Button()
                {
                    Y = btnTipNot.Bottom + Application.GetRealHeight(16),
                    Height = Application.GetRealHeight(20),
                    TextID = StringId.secnenull,
                    TextColor = CSS.CSS_Color.textColor,
                    TextSize = LogicView.TextSize.text14,
                    TextAlignment = TextAlignment.Center,
                };
                view.frameLayout.AddChidren(btnTipNotText);
            }
            else if (list.Count > 0 && list.Count <= 5)
            {
                view.frameLayout.AddChidren(frameL);
            }
            else if (list.Count > 5)
            {
                view.frameLayout.AddChidren(verticalRefresh);
            }
            ///定义一个Btn记录选中状态
            Button checkBtn = new Button
            {
                Tag = "unknown",
            };
            for (int i = 0; i < list.Count; i++)
            {
                string strName = list[i];
                LogicView.CheckView checkView = new LogicView.CheckView();
                checkView.btnText.TextSize = LogicView.TextSize.text14;
                if (list.Count <= 5)
                {
                    checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
                    frameL.AddChidren(checkView.FLayoutView());
                    if (line - 1 == i)
                    {
                        checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
                    }
                }
                else
                {
                    verticalRefresh.AddChidren(checkView.FLayoutView());
                }
                checkView.btnText.Text = strName;
                checkView.btnClick.Tag = i;//标记
                //点击事件
                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                {
                    checkBtn.IsSelected = false;
                    checkView.btnCheckIcon.IsSelected = true;
                    checkBtn = checkView.btnCheckIcon;
                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
                };
            }
            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (checkBtn.Tag.ToString() == "unknown")
                {
                    return;
                }
                //列表索引值
                int indexValue = int.Parse(checkBtn.Tag.ToString());
                action(indexValue);
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 获取界面列表
        /// </summary>
        /// <param name="isStr">自己定义自己用</param>
@@ -321,7 +458,7 @@
        /// <summary>
        /// 模式/风速互相转换值的方法
        /// </summary>
        /// <param name="text"></param>
        /// <param name="text">文本</param>
        /// <param name="type">自己定义自己用</param>
        /// <returns></returns>
        public string GetModeValueString(string text, string type)