using System;
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 一个简单的条形进度条
|
/// </summary>
|
public class ProgressLine : FrameLayout
|
{
|
/// <summary>
|
/// 一个简单的条形进度条
|
/// </summary>
|
/// <param name="height">进度条高度</param>
|
/// <param name="width">进度条宽度</param>
|
public ProgressLine(int height = 3, int width = 1080)
|
{
|
this.Width = Application.GetRealWidth(width);
|
this.Height = height;
|
this.BackgroundColor = UserCenterColor.Current.DeepGray1;
|
}
|
|
/// <summary>
|
/// 设定进度值
|
/// </summary>
|
/// <param name="value">进度值(与100的比率)</param>
|
/// <param name="isLeft">从左边开始进度</param>
|
public void SetValue(decimal value, bool isLeft = true)
|
{
|
this.RemoveAll();
|
Button button = new Button();
|
button.Height = this.Height;
|
int width = (int)((value / 100) * this.Width);
|
if (isLeft == false)
|
{
|
button.X = this.Width - width;
|
}
|
button.Width = width;
|
button.BackgroundColor = UserCenterColor.Current.SelectTextColor;
|
this.AddChidren(button);
|
}
|
}
|
}
|