wei
2021-01-27 7232642ff48a7fbde2018cde652f3e771fa58025
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
old mode 100644 new mode 100755
@@ -72,22 +72,22 @@
        /// </summary>
        public Button btn_subtract_click = new Button
        {
            Width = Application.GetMinRealAverage(24+20),
            Width = Application.GetMinRealAverage(24 + 20),
            Height = Application.GetMinRealAverage(24),
            X = Application.GetRealWidth(26-20),
            X = Application.GetRealWidth(26 - 20),
            Y = Application.GetRealHeight(118),
        };
        public DiyImageSeekBar seekBarVol = new DiyImageSeekBar
        {
            Y = Application.GetRealHeight(103),//进度条父控件Y坐标
            X = Application.GetRealWidth(62-10),//进度条X坐标
            SeekBarPadding=Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距);
            X = Application.GetRealWidth(62 - 10),//进度条X坐标
            SeekBarPadding = Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距);
            Width = Application.GetRealWidth(240),//进度条的长度
            Height = Application.GetRealHeight(54),//进度条父控件高度
            IsProgressTextShow = true,//显示百分比
            IsClickable = true,//进度条是否滑动
            ProgressBarColor =CSS.CSS_Color.textConfirmColor,//选中进度条颜色
            ProgressBarColor = CSS.CSS_Color.textConfirmColor,//选中进度条颜色
            ThumbImagePath = "LogicIcon/point.png",//进度条按钮图标
            ThumbImageHeight = Application.GetRealHeight(54),//进度条按钮图标的高度(默认正方形:宽和高一样)
            ProgressTextColor = CSS.CSS_Color.textColor,
@@ -111,17 +111,28 @@
        /// </summary>
        public Button btn_add_click = new Button
        {
            Width = Application.GetMinRealAverage(24+20),
            Width = Application.GetMinRealAverage(24 + 20),
            Height = Application.GetMinRealAverage(24),
            X = Application.GetRealWidth(294),
            Y = Application.GetRealHeight(118),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <param name="fLayout"></param>
        public void FLayoutView(FrameLayout fLayout)
        /// <param name="frame">父控件</param>
        /// <param name="titleName">标题名称</param>
        /// <param name="stateValue">之前状态值</param>
        /// <param name="action">返回回调</param>
        public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string> action)
        {
            FrameLayout fLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            frame.AddChidren(fLayout);
            fLayout.AddChidren(frameLayout);
            frameLayout.AddChidren(btnTitle);
            frameLayout.AddChidren(btnCancel);
@@ -131,13 +142,91 @@
            frameLayout.AddChidren(seekBarVol);
            frameLayout.AddChidren(btn_add);
            frameLayout.AddChidren(btn_add_click);
            btnTitle.Text = titleName;
            //第一个变化记录选中值
            int brightnesValue = 0;
            if (stateValue != "")
            {
                try
                {
                    //进来的状态
                    brightnesValue = int.Parse(stateValue.Replace("%", ""));
                    seekBarVol.Progress = brightnesValue;
                }
                catch { }
            }
            //—点击事件
            btn_subtract_click.MouseUpEventHandler += (sender2, e2) =>
            {
                if (brightnesValue > 0)
                {
                    brightnesValue -= 1;
                    seekBarVol.Progress = brightnesValue;
                }
            };
            //+点击事件
            btn_add_click.MouseUpEventHandler += (sende2, e2) =>
            {
                if (brightnesValue < 100)
                {
                    brightnesValue += 1;
                    seekBarVol.Progress = brightnesValue;
                }
            };
            //进度条滑动点击事件
            EventHandler<int> progressclick = (sender2, e2) =>
            {
                brightnesValue = seekBarVol.Progress;
            };
            seekBarVol.OnProgressChangedEvent += progressclick;
            seekBarVol.OnStopTrackingTouchEvent += progressclick;
            //取消点击事件
            btnCancel.MouseUpEventHandler += (sender, e1) =>
            {
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
            //确定点击事件
            btnConfirm.MouseUpEventHandler += (sender, e1) =>
            {
                //if (brightnesValue == 0)
                //{
                //    return;
                //}
                action(brightnesValue.ToString());
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
        }
        ///// <summary>
        ///// View的方法
        ///// </summary>
        ///// <param name="fLayout"></param>
        //public void FLayoutView(FrameLayout fLayout)
        //{
        //    fLayout.AddChidren(frameLayout);
        //    frameLayout.AddChidren(btnTitle);
        //    frameLayout.AddChidren(btnCancel);
        //    frameLayout.AddChidren(btnConfirm);
        //    frameLayout.AddChidren(btn_subtract);
        //    frameLayout.AddChidren(btn_subtract_click);
        //    frameLayout.AddChidren(seekBarVol);
        //    frameLayout.AddChidren(btn_add);
        //    frameLayout.AddChidren(btn_add_click);
        //    //取消点击事件
        //    btnCancel.MouseUpEventHandler += (sender, e1) =>
        //    {
        //        //移除fLayout界面
        //        fLayout.RemoveFromParent();
        //    };
        //}
    }
}