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 { /// /// UCProcessBar.xaml 的交互逻辑 /// public partial class UCProgressBar : UserControl { public UCProgressBar() { InitializeComponent(); } #region 缓存区域缓存数量 /// /// 缓存区域缓存数量 /// 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 缓存区域剩余数量 /// /// 缓存区域剩余数量 /// 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 产品型号 /// /// 产品型号 /// 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 最大值 /// /// 产品型号 /// 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 进度值 /// /// 产品型号 /// 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 } }