wxr
2020-12-21 f25c6122eb7e26be5e7f036cf29b9019c4953be2
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
@@ -91,13 +91,17 @@
            Width = Application.GetRealWidth(343),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        ///  <param name="frame">父控件</param>
        /// <param name="i">显示选择View数量</param>
        ///<param name="stateVuale">之前的状态值</param>
        /// <param name="action">返回回调</param>
        /// <returns></returns>
        public void FLayoutView(FrameLayout frame, int i)
        public void FLayoutView(FrameLayout frame, int i,string stateVuale,Action<string>action)
        {
            frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
            frameLayout.Height = Application.GetRealHeight(44 * i);
@@ -112,11 +116,79 @@
                frameLayout.AddChidren(btnLine1);
                frameLayout.AddChidren(btnStop);
            }
            //取消点击事件
            btnCancel.MouseUpEventHandler += (sender1, e1) =>
            {
                frame.RemoveFromParent();
            };
            ///显示之前状态
            if (stateVuale != "")
            {
                if (stateVuale ==btnOn.Text)
                {
                    btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
                }
                else if (stateVuale == btnOff.Text)
                {
                    btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
                }
                else if (stateVuale == btnStop.Text)
                {
                    btnStop.TextColor = CSS.CSS_Color.textConfirmColor;
                }
            }
            //开-点击事件
            btnOn.MouseUpEventHandler += (sender2, e2) =>
            {
                action("on");
                frame.RemoveFromParent();
            };
            //关-点击事件
            btnOff.MouseUpEventHandler += (sender3, e3) =>
            {
                action("off");
                frame.RemoveFromParent();
            };
            //暂停-点击事件
            btnStop.MouseUpEventHandler += (sender3, e3) =>
            {
                action("stop");
                frame.RemoveFromParent();
            };
        }
        ///// <summary>
        ///// View的方法
        ///// </summary>
        /////  <param name="frame">父控件</param>
        ///// <param name="i">显示选择View数量</param>
        ///// <returns></returns>
        //public void FLayoutView(FrameLayout frame, int i)
        //{
        //    frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
        //    frameLayout.Height = Application.GetRealHeight(44 * i);
        //    frame.AddChidren(frameLayout);
        //    frame.AddChidren(btnCancel);
        //    frameLayout.AddChidren(btnOn);
        //    frameLayout.AddChidren(btnLine);
        //    frameLayout.AddChidren(btnOff);
        //    if (i > 2)
        //    {
        //        /// 判断是否要是显示"暂停"按钮
        //        frameLayout.AddChidren(btnLine1);
        //        frameLayout.AddChidren(btnStop);
        //    }
        //    btnCancel.MouseUpEventHandler += (sender1, e1) =>
        //    {
        //        frame.RemoveFromParent();
        //    };
        //}
    }
}