xm
2020-04-16 6fa9d69da922c8049f5acfcbb9ce9fd26811024c
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs
@@ -29,7 +29,14 @@
                return m_Current;
            }
        }
        /// <summary>
        /// 消息控件单击的事件
        /// </summary>
        public Action MsgClickEvent = null;
        /// <summary>
        /// 界面关闭的事件
        /// </summary>
        public Action CloseEvent = null;
        /// <summary>
        /// 容器控件
        /// </summary>
@@ -58,6 +65,10 @@
        /// 原来的滑动标识
        /// </summary>
        private bool oldScrollEnabled = false;
        /// <summary>
        /// 原来的那个圆形进度条是否可见
        /// </summary>
        private bool oldPrigressVisible = false;
        #endregion
@@ -68,23 +79,26 @@
        /// </summary>
        private void InitProgressFormBar()
        {
            var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
            if (nowForm == null || (nowForm is ViewGroup) == false)
            {
                //这种情况应该不存在
                var alert = new ShowMsgControl(ShowMsgType.Error, "ERROR:Not Found The ActionForm!");
                alert.Show();
                return;
            }
            //安卓可以点击系统的返回键
            this.oldScrollEnabled = UserView.HomePage.Instance.ScrollEnabled;
            UserView.HomePage.Instance.ScrollEnabled = false;
            Shared.Common.CommonPage.BackKeyCanClick = false;
            this.oldPrigressVisible = Common.CommonPage.Loading.Visible;
            if (oldPrigressVisible == true)
            {
                //圆形进度条临时关闭
                Common.CommonPage.Loading.Hide();
            }
            //容器
            bodyFrameLayout = new FrameLayout();
            bodyFrameLayout.BackgroundColor = UserCenterColor.Current.DialogBackColor;
            ((ViewGroup)nowForm).AddChidren(bodyFrameLayout);
            Common.CommonPage.Instance.AddChidren(bodyFrameLayout);
            //var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
            //if (nowForm != null && (nowForm is ViewGroup) == true)
            //{
            //    ((ViewGroup)nowForm).AddChidren(bodyFrameLayout);
            //}
            var frameBack = new FrameLayout();
            frameBack.Width = Application.GetRealWidth(674);
@@ -92,7 +106,7 @@
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.Y = Application.GetRealHeight(683);
            frameBack.Radius = 6;
            frameBack.Radius = (uint)Application.GetRealHeight(17);
            bodyFrameLayout.AddChidren(frameBack);
            //进度显示文本
@@ -101,6 +115,10 @@
            btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnText.TextAlignment = TextAlignment.Center;
            frameBack.AddChidren(btnText);
            btnText.ButtonClickEvent += (sender, e) =>
            {
                this.MsgClickEvent?.Invoke();
            };
            //进度条
            var btnProRow = new FrameLayout();
@@ -114,7 +132,6 @@
            this.btnProgressBar = new FrameLayout();
            btnProgressBar.Width = 0;
            btnProgressBar.Height = btnProRow.Height;
            btnProgressBar.Radius = btnProRow.Radius;
            btnProgressBar.BackgroundColor = 0xfffb744a;
            btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2;
            btnProRow.AddChidren(btnProgressBar);
@@ -129,7 +146,7 @@
            var btnProgressPic = new PicViewControl(84, 60);
            btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
            frameProgress.AddChidren(btnProgressPic);
            this.btnProgressView = new NormalViewControl(84, 32, true);
            this.btnProgressView = new NormalViewControl(84, 45, true);
            btnProgressView.TextSize = 10;
            btnProgressView.TextAlignment = TextAlignment.Center;
            btnProgressView.Text = "0%";
@@ -172,7 +189,7 @@
        /// </summary>
        /// <param name="value">进度值,内部会除以maxValue</param>
        /// <param name="maxValue">最大值</param>
        public void SetValue2(decimal value, decimal maxValue)
        public void SetValue(decimal value, decimal maxValue)
        {
            decimal result = value / maxValue;
            this.SetValueEx(result);
@@ -184,6 +201,10 @@
        /// <param name="value"></param>
        private void SetValueEx(decimal value)
        {
            if (btnProgressBar == null)
            {
                return;
            }
            HdlThreadLogic.Current.RunMain(() =>
            {
                int width = (int)(value * ProRowWidth);
@@ -223,21 +244,30 @@
        /// </summary>
        public void Close()
        {
            if (this.oldScrollEnabled == true)
            {
                //如果它原来就是不可以滑动的话,不处理
                UserView.HomePage.Instance.ScrollEnabled = true;
            }
            Shared.Common.CommonPage.BackKeyCanClick = true;
            HdlThreadLogic.Current.RunMain(() =>
            {
                if (this.oldScrollEnabled == true)
                {
                    //如果它原来就是不可以滑动的话,不处理
                    UserView.HomePage.Instance.ScrollEnabled = true;
                }
                Shared.Common.CommonPage.BackKeyCanClick = true;
                if (this.oldPrigressVisible == true)
                {
                    //如果原来的进度条是可见的话,还原回去
                    Common.CommonPage.Loading.Start(Common.CommonPage.Loading.Text);
                }
                bodyFrameLayout?.RemoveFromParent();
                bodyFrameLayout = null;
                btnText = null;
                btnProgressView = null;
                frameProgress = null;
                btnProgressBar = null;
                this.MsgClickEvent = null;
                //关闭事件
                this.CloseEvent?.Invoke();
                this.CloseEvent = null;
            });
        }