wxr
2020-12-21 f25c6122eb7e26be5e7f036cf29b9019c4953be2
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
@@ -116,11 +116,17 @@
            X = Application.GetRealWidth(294),
            Y = Application.GetRealHeight(118),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <param name="fLayout"></param>
        public void FLayoutView(FrameLayout fLayout)
        /// <param name="fLayout">父控件</param>
        /// <param name="titleName">标题名称</param>
        /// <param name="stateValue">之前状态值</param>
        /// <param name="action">返回回调</param>
        public void FLayoutView(FrameLayout fLayout, string titleName,string stateValue, Action<string> action)
        {
            fLayout.AddChidren(frameLayout);
            frameLayout.AddChidren(btnTitle);
@@ -131,13 +137,90 @@
            frameLayout.AddChidren(seekBarVol);
            frameLayout.AddChidren(btn_add);
            frameLayout.AddChidren(btn_add_click);
            //第一个变化记录选中值
            int brightnesValue = 0;
            if (stateValue != "")
            {
                try
                {
                    //进来的状态
                    brightnesValue = int.Parse(stateValue);
                    seekBarVol.Progress = int.Parse(stateValue);
                }
                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();
        //    };
        //}
    }
}