You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
6.4 KiB
C#

using CommonFunc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XGL.UControl
{
/// <summary>
/// UCProcessBar.xaml 的交互逻辑
/// </summary>
public partial class UCRProgressBar : UserControl
{
public UCRProgressBar()
{
InitializeComponent();
}
#region 缓存区域缓存数量
/// <summary>
/// 缓存区域缓存数量
/// </summary>
public string TotalNum
{
get
{
return (string)GetValue(TotalNumProperty);
}
set
{
SetValue(TotalNumProperty, value);
}
}
public static DependencyProperty TotalNumProperty =
DependencyProperty.Register("TotalNum", typeof(string), typeof(UCProgressBar), new PropertyMetadata("", new PropertyChangedCallback(TotalNumPropertyChanged))); //属性默认值
private static void TotalNumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
try
{
var control = d as UCProgressBar;
control.txtTotal.Text = e.NewValue.ToString();
}
catch (Exception ex)
{
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
}
}
#endregion
#region 缓存区域剩余数量
/// <summary>
/// 缓存区域剩余数量
/// </summary>
public string LeftNum
{
get
{
return (string)GetValue(LeftNumProperty);
}
set
{
SetValue(LeftNumProperty, value);
}
}
public static DependencyProperty LeftNumProperty =
DependencyProperty.Register("LeftNum", typeof(string), typeof(UCProgressBar), new PropertyMetadata("", new PropertyChangedCallback(LeftNumPropertyChanged))); //属性默认值
private static void LeftNumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
try
{
var control = d as UCProgressBar;
control.txtLeft.Text = e.NewValue.ToString();
}
catch (Exception ex)
{
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
}
}
#endregion
#region 产品型号
/// <summary>
/// 产品型号
/// </summary>
public string ProdDesc
{
get
{
return (string)GetValue(ProdDescProperty);
}
set
{
SetValue(ProdDescProperty, value);
}
}
public static DependencyProperty ProdDescProperty =
DependencyProperty.Register("ProdDesc", typeof(string), typeof(UCProgressBar), new PropertyMetadata("", new PropertyChangedCallback(ProdDescPropertyChanged))); //属性默认值
private static void ProdDescPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
try
{
var control = d as UCProgressBar;
control.txtProdDesc.Text = e.NewValue.ToString();
}
catch (Exception ex)
{
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
}
}
#endregion
#region 最大值
/// <summary>
/// 产品型号
/// </summary>
public double MaxValue
{
get
{
return (double)GetValue(MaxValueProperty);
}
set
{
SetValue(MaxValueProperty, value);
}
}
public static DependencyProperty MaxValueProperty =
DependencyProperty.Register("MaxValue", typeof(string), typeof(UCProgressBar), new PropertyMetadata((double)1, new PropertyChangedCallback(MaxValuePropertyChanged))); //属性默认值
private static void MaxValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
try
{
var control = d as UCProgressBar;
control.myProgressBar.Maximum = (double)e.NewValue;
}
catch (Exception ex)
{
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
}
}
#endregion
#region 进度值
/// <summary>
/// 产品型号
/// </summary>
public double Value
{
get
{
return (double)GetValue(ValueProperty);
}
set
{
SetValue(ValueProperty, value);
}
}
public static DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(UCProgressBar), new PropertyMetadata((double)0, new PropertyChangedCallback(ValuePropertyChanged))); //属性默认值
private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
try
{
var control = d as UCProgressBar;
control.myProgressBar.Value = (double)e.NewValue;
}
catch (Exception ex)
{
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
}
}
#endregion
}
}