黄学彪
2019-12-09 163777d8a2cb7cfa469f54a7042528870ebc10a3
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,16 +39,12 @@
        /// 子控件Y轴偏移量(共通定义而已)
        /// </summary>
        public int chidrenYaxis = 0;
        /// <summary>
        /// 圆角度(安卓和IOS或许需要预编译)
        /// 圆角度
        /// </summary>
        public uint RadiusEx
        public int RadiusEx
        {
            set
            {
                this.Radius = value;
            }
            set { this.Radius = (uint)Application.GetRealHeight(value); }
        }
        #endregion
@@ -61,14 +61,6 @@
            this.MouseUpEventHandler += ChildrenUpEvent;
            this.MouseDownEventHandler += ChildrenDownEvent;
        }
        /// <summary>
        /// 做成一个普通的FrameLayout控件
        /// </summary>
        /// <param name="flage">没啥用的东西</param>
        public FrameLayoutControl(bool flage)
        {
        }
        #endregion
@@ -90,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)
            {
@@ -124,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;
@@ -134,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;
@@ -182,7 +194,6 @@
            //绑定子控件事件
            this.BindChidrenEvent(view, chidrenBindMode);
        }
        #endregion
@@ -196,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;
            }
@@ -210,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