gxc
2020-01-02 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutControl.cs
@@ -24,6 +24,10 @@
        /// </summary>
        public bool UseClickStatu = true;
        /// <summary>
        /// 能否点击
        /// </summary>
        public bool CanClick = true;
        /// <summary>
        /// 原来的背景色
        /// </summary>
        private uint oldBackColor = 0;
@@ -35,6 +39,13 @@
        /// 子控件Y轴偏移量(共通定义而已)
        /// </summary>
        public int chidrenYaxis = 0;
        /// <summary>
        /// 圆角度
        /// </summary>
        public int RadiusEx
        {
            set { this.Radius = (uint)Application.GetRealHeight(value); }
        }
        #endregion
@@ -50,7 +61,7 @@
            this.MouseUpEventHandler += ChildrenUpEvent;
            this.MouseDownEventHandler += ChildrenDownEvent;
        }
        }
        #endregion
@@ -71,6 +82,13 @@
                button.MouseDownEventHandler -= ChildrenDownEvent;
                this.BindChidrenEvent(view, chidrenBindMode);
            }
            else if (view is ImageView)
            {
                view.MouseUpEventHandler -= ChildrenUpEvent;
                view.MouseDownEventHandler -= ChildrenDownEvent;
                this.BindChidrenEvent(view, chidrenBindMode);
            }
            else if (view is ViewGroup)
            {
@@ -105,7 +123,11 @@
        /// <param name="chidrenBindMode"></param>
        private void BindChidrenEvent(View view, ChidrenBindMode chidrenBindMode)
        {
            if (view is ButtonBase && chidrenBindMode != ChidrenBindMode.NotBind)
            if (chidrenBindMode == ChidrenBindMode.NotBind)
            {
                return;
            }
            if (view is ButtonBase)
            {
                //为子控件添加事件
                ButtonBase button = (ButtonBase)view;
@@ -115,7 +137,16 @@
                button.ButtonClickEvent += ChildrenUpEvent;
                button.MouseDownEventHandler += ChildrenDownEvent;
            }
            else if (view is ViewGroup && chidrenBindMode != ChidrenBindMode.NotBind)
            else if (view is ImageView)
            {
                //自身也添加事件
                view.MouseUpEventHandler -= ChildrenUpEvent;
                view.MouseDownEventHandler -= ChildrenDownEvent;
                view.MouseUpEventHandler += ChildrenUpEvent;
                view.MouseDownEventHandler += ChildrenDownEvent;
            }
            else if (view is ViewGroup)
            {
                //为子控件添加事件
                ViewGroup groupContr = (ViewGroup)view;
@@ -163,7 +194,6 @@
            //绑定子控件事件
            this.BindChidrenEvent(view, chidrenBindMode);
        }
        #endregion
@@ -177,7 +207,7 @@
        /// <param name="e">E.</param>
        private void ChildrenDownEvent(object sender, MouseEventArgs e)
        {
            if (this.UseClickStatu == false)
            if (this.UseClickStatu == false|| this.CanClick == false)
            {
                return;
            }
@@ -191,13 +221,29 @@
        /// <param name="e">E.</param>
        private void ChildrenUpEvent(object sender, MouseEventArgs e)
        {
            if (this.CanClick == false)
            {
                //不允许点击
                return;
            }
            if (sender is FrameLayoutControl)
            {
                //LOG出力
                this.WriteLog();
            }
            //调用委托
            ButtonClickEvent?.Invoke(sender, e);
            try
            {
                //调用委托
                ButtonClickEvent?.Invoke(sender, e);
            }
            catch (Exception ex)
            {
                //出现未知错误
                var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
                alert.Show();
                //Log出力
                HdlLogLogic.Current.WriteLog(ex);
            }
        }
        #endregion