old mode 100755
new mode 100644
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 界面类型的进度条控件
|
| | | /// </summary>
|
| | | public class ProgressFormBar
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面类型的进度条控件
|
| | | /// </summary>
|
| | | private static ProgressFormBar m_Current = null;
|
| | | /// <summary>
|
| | | /// 界面类型的进度条控件
|
| | | /// </summary>
|
| | | public static ProgressFormBar Current
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_Current == null)
|
| | | {
|
| | | m_Current = new ProgressFormBar();
|
| | | }
|
| | | return m_Current;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 容器控件
|
| | | /// </summary>
|
| | | private FrameLayout bodyFrameLayout = null;
|
| | | /// <summary>
|
| | | /// 信息控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnText = null;
|
| | | /// <summary>
|
| | | /// 进度值文本的显示控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnProgressView = null;
|
| | | /// <summary>
|
| | | /// 进度值能够移动的那个框控件
|
| | | /// </summary>
|
| | | private FrameLayout frameProgress = null;
|
| | | /// <summary>
|
| | | /// 进度条
|
| | | /// </summary>
|
| | | private FrameLayout btnProgressBar = null;
|
| | | /// <summary>
|
| | | /// 进度条容器的最大宽度
|
| | | /// </summary>
|
| | | private int ProRowWidth = 0;
|
| | | /// <summary>
|
| | | /// 原来的滑动标识
|
| | | /// </summary>
|
| | | private bool oldScrollEnabled = false;
|
| | | /// <summary>
|
| | | /// 原来的那个圆形进度条是否可见
|
| | | /// </summary>
|
| | | private bool oldPrigressVisible = false;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化进度条
|
| | | /// </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);
|
| | |
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Width = Application.GetRealWidth(674);
|
| | | frameBack.Height = Application.GetRealHeight(386);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameBack.Y = Application.GetRealHeight(683);
|
| | | frameBack.Radius = 6;
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //进度显示文本
|
| | | this.btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false);
|
| | | btnText.Y = Application.GetRealHeight(248);
|
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnText.TextAlignment = TextAlignment.Center;
|
| | | frameBack.AddChidren(btnText);
|
| | |
|
| | | //进度条
|
| | | var btnProRow = new FrameLayout();
|
| | | btnProRow.Gravity = Gravity.CenterHorizontal;
|
| | | btnProRow.Y = Application.GetRealHeight(161);
|
| | | btnProRow.Width = Application.GetRealWidth(559);
|
| | | btnProRow.Height = Application.GetRealHeight(29);
|
| | | btnProRow.BackgroundColor = 0xfff5f5f5;
|
| | | btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2;
|
| | | frameBack.AddChidren(btnProRow);
|
| | | 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);
|
| | |
|
| | | //进度值文本
|
| | | this.frameProgress = new FrameLayout();
|
| | | frameProgress.Width = Application.GetRealWidth(84);
|
| | | frameProgress.Height = Application.GetRealHeight(60);
|
| | | frameProgress.Y = Application.GetRealHeight(86);
|
| | | frameBack.AddChidren(frameProgress);
|
| | | frameProgress.X = btnProRow.X + btnProgressBar.Right - frameProgress.Width / 2;
|
| | | var btnProgressPic = new PicViewControl(84, 60);
|
| | | btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
|
| | | frameProgress.AddChidren(btnProgressPic);
|
| | | this.btnProgressView = new NormalViewControl(84, 32, true);
|
| | | btnProgressView.TextSize = 10;
|
| | | btnProgressView.TextAlignment = TextAlignment.Center;
|
| | | btnProgressView.Text = "0%";
|
| | | frameProgress.AddChidren(btnProgressView);
|
| | |
|
| | | this.ProRowWidth = btnProRow.Width;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置信息___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置显示信息
|
| | | /// </summary>
|
| | | /// <param name="msg"></param>
|
| | | public void SetMsg(string msg)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnText.Text = msg;
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置进度值_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置进度值
|
| | | /// </summary>
|
| | | /// <param name="value">此值为百分比值(也就是小于或者等于1的)</param>
|
| | | public void SetValue(decimal value)
|
| | | {
|
| | | this.SetValueEx(value);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置进度值
|
| | | /// </summary>
|
| | | /// <param name="value">进度值,内部会除以maxValue</param>
|
| | | /// <param name="maxValue">最大值</param>
|
| | | public void SetValue(decimal value, decimal maxValue)
|
| | | {
|
| | | decimal result = value / maxValue;
|
| | | this.SetValueEx(result);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置进度值
|
| | | /// </summary>
|
| | | /// <param name="value"></param>
|
| | | private void SetValueEx(decimal value)
|
| | | {
|
| | | if (btnProgressBar == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | int width = (int)(value * ProRowWidth);
|
| | | btnProgressBar.Width = width;
|
| | | //文本显示
|
| | | btnProgressView.Text = ((int)(value * 100)) + "%";
|
| | | //文本显示的那个图片框移动
|
| | | frameProgress.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgress.Width / 2;
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 开启进度条_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启进度条
|
| | | /// </summary>
|
| | | public void Start()
|
| | | {
|
| | | if (this.bodyFrameLayout == null)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //初始化进度条
|
| | | this.InitProgressFormBar();
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 关闭进度条_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 关闭进度条
|
| | | /// </summary>
|
| | | public void Close()
|
| | | {
|
| | | 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;
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 界面类型的进度条控件 |
| | | /// </summary> |
| | | public class ProgressFormBar |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面类型的进度条控件 |
| | | /// </summary> |
| | | private static ProgressFormBar m_Current = null; |
| | | /// <summary> |
| | | /// 界面类型的进度条控件 |
| | | /// </summary> |
| | | public static ProgressFormBar Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | m_Current = new ProgressFormBar(); |
| | | } |
| | | return m_Current; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 消息控件单击的事件 |
| | | /// </summary> |
| | | public Action MsgClickEvent = null; |
| | | /// <summary> |
| | | /// 界面关闭的事件 |
| | | /// </summary> |
| | | public Action CloseEvent = null; |
| | | /// <summary> |
| | | /// 容器控件 |
| | | /// </summary> |
| | | private FrameLayout bodyFrameLayout = null; |
| | | /// <summary> |
| | | /// 信息控件 |
| | | /// </summary> |
| | | private NormalViewControl btnText = null; |
| | | /// <summary> |
| | | /// 进度条控件 |
| | | /// </summary> |
| | | private ProgressRowBar btnProgressBar = null; |
| | | /// <summary> |
| | | /// 原来的滑动标识 |
| | | /// </summary> |
| | | private bool oldScrollEnabled = false; |
| | | /// <summary> |
| | | /// 原来的那个圆形进度条是否可见 |
| | | /// </summary> |
| | | private bool oldPrigressVisible = false; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化进度条 |
| | | /// </summary> |
| | | private void InitProgressFormBar() |
| | | { |
| | | //安卓可以点击系统的返回键 |
| | | 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; |
| | | Common.CommonPage.Instance.AddChidren(bodyFrameLayout); |
| | | |
| | | var frameBack = new FrameLayout(); |
| | | frameBack.Width = Application.GetRealWidth(674); |
| | | frameBack.Height = Application.GetRealHeight(386); |
| | | frameBack.BackgroundColor = UserCenterColor.Current.White; |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.Y = Application.GetRealHeight(683); |
| | | frameBack.Radius = (uint)Application.GetRealHeight(17); |
| | | bodyFrameLayout.AddChidren(frameBack); |
| | | |
| | | //进度显示文本 |
| | | this.btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false); |
| | | btnText.Y = Application.GetRealHeight(248); |
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor1; |
| | | btnText.TextAlignment = TextAlignment.Center; |
| | | frameBack.AddChidren(btnText); |
| | | btnText.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.MsgClickEvent?.Invoke(); |
| | | }; |
| | | |
| | | //进度条 |
| | | this.btnProgressBar = new ProgressRowBar(559, 29); |
| | | btnProgressBar.Gravity = Gravity.CenterHorizontal; |
| | | btnProgressBar.Y = Application.GetRealHeight(161); |
| | | frameBack.AddChidren(btnProgressBar); |
| | | btnProgressBar.StartMode1(true); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设置信息___________________________ |
| | | |
| | | /// <summary> |
| | | /// 设置显示信息 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void SetMsg(string msg) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | btnText.Text = msg; |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设置进度值_________________________ |
| | | |
| | | /// <summary> |
| | | /// 设置进度值 |
| | | /// </summary> |
| | | /// <param name="value">此值为百分比值(也就是小于或者等于1的)</param> |
| | | public void SetValue(decimal value) |
| | | { |
| | | this.btnProgressBar?.SetValue(value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置进度值 |
| | | /// </summary> |
| | | /// <param name="value">进度值,内部会除以maxValue</param> |
| | | /// <param name="maxValue">最大值</param> |
| | | public void SetValue(decimal value, decimal maxValue) |
| | | { |
| | | this.btnProgressBar?.SetValue(value, maxValue); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重置进度条,让它复位 |
| | | /// </summary> |
| | | public void ResetProgressBar() |
| | | { |
| | | if (this.btnProgressBar != null) |
| | | { |
| | | btnProgressBar.ProgressBarGoback = true; |
| | | btnProgressBar.SetValue(0); |
| | | |
| | | System.Threading.Thread.Sleep(500); |
| | | |
| | | btnProgressBar.ProgressBarGoback = false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 开启进度条_________________________ |
| | | |
| | | /// <summary> |
| | | /// 开启进度条 |
| | | /// </summary> |
| | | public void Start() |
| | | { |
| | | if (this.bodyFrameLayout == null) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //初始化进度条 |
| | | this.InitProgressFormBar(); |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 关闭进度条_________________________ |
| | | |
| | | /// <summary> |
| | | /// 关闭进度条 |
| | | /// </summary> |
| | | public void Close() |
| | | { |
| | | 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; |
| | | btnProgressBar = null; |
| | | this.MsgClickEvent = null; |
| | | //关闭事件 |
| | | this.CloseEvent?.Invoke(); |
| | | this.CloseEvent = null; |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |