using System;
using System.Collections.Generic;
using System.Linq;
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;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace ClassLibraryTest
{
///
/// UserControl1.xaml 的交互逻辑
///
public partial class GraphScanCircular : UserControl, IGraphScanCircular, INotifyPropertyChanged
{
public GraphScanCircular()
{
InitializeComponent();
}
#region IGraphScanCircular
public static readonly DependencyProperty BoltCntProperty =
DependencyProperty.Register("BoltCnt", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
88,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("BoltCnt");
})));
public int BoltCnt
{
get
{
return (int)GetValue(BoltCntProperty);
}
set
{
SetValue(BoltCntProperty, value);
}
}
public static readonly DependencyProperty ManualCntProperty =
DependencyProperty.Register("ManualCnt", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
8,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("ManualCnt");
})));
public int ManualCnt
{
get
{
return (int)GetValue(ManualCntProperty);
}
set
{
SetValue(ManualCntProperty, value);
}
}
public static readonly DependencyProperty MPIsRightProperty =
DependencyProperty.Register("MPIsRight", typeof(bool), typeof(GraphScanCircular), new PropertyMetadata(
true,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("MPIsRight");
})));
public bool MPIsRight
{
get
{
return (bool)GetValue(MPIsRightProperty);
}
set
{
SetValue(MPIsRightProperty, value);
}
}
public static readonly DependencyProperty OrgBoltNoProperty =
DependencyProperty.Register("OrgBoltNo", typeof(double), typeof(GraphScanCircular), new PropertyMetadata(
1,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("OrgBoltNo");
})));
public double OrgBoltNo
{
get
{
return (int)GetValue(OrgBoltNoProperty);
}
set
{
SetValue(OrgBoltNoProperty, value);
}
}
public static readonly DependencyProperty BoltNoWithManual1stProperty =
DependencyProperty.Register("BoltNoWithManual1st", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
1,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("BoltNoWithManual1st");
})));
public int BoltNoWithManual1st
{
get
{
return (int)GetValue(BoltNoWithManual1stProperty);
}
set
{
SetValue(BoltNoWithManual1stProperty, value);
}
}
public static readonly DependencyProperty AlarmProperty =
DependencyProperty.Register("Alarm", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
1000,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("Alarm");
})));
public int Alarm
{
get
{
return (int)GetValue(AlarmProperty);
}
set
{
SetValue(AlarmProperty, value);
}
}
public static readonly DependencyProperty TargetProperty =
DependencyProperty.Register("Target", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
10000,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("Target");
})));
public int Target
{
get
{
return (int)GetValue(TargetProperty);
}
set
{
SetValue(TargetProperty, value);
}
}
public static readonly DependencyProperty EmptyValueProperty =
DependencyProperty.Register("EmptyValue", typeof(int), typeof(GraphScanCircular), new PropertyMetadata(
99999998,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("EmptyValue");
})));
public int EmptyValue
{
get
{
return (int)GetValue(EmptyValueProperty);
}
set
{
SetValue(EmptyValueProperty, value);
}
}
public static readonly DependencyProperty MultiProperty =
DependencyProperty.Register("Multi", typeof(double), typeof(GraphScanCircular), new PropertyMetadata(
100,
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("Multi");
})));
public double Multi
{
get
{
return (int)GetValue(MultiProperty);
}
set
{
SetValue(MultiProperty, value);
}
}
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(double), typeof(GraphScanCircular), new PropertyMetadata(
"Title",
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("Title");
})));
public string Title
{
get
{
return (string)GetValue(TitleProperty);
}
set
{
SetValue(TitleProperty, value);
}
}
public static readonly DependencyProperty Title2Property =
DependencyProperty.Register("Title2", typeof(double), typeof(GraphScanCircular), new PropertyMetadata(
"Title2",
new PropertyChangedCallback(delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as GraphScanCircular).NotifyPropertyChanged("Title2");
})));
public string Title2
{
get
{
return (string)GetValue(Title2Property);
}
set
{
SetValue(Title2Property, value);
}
}
ObservableCollection dataSource;
public ObservableCollection DataSource
{
get
{
return dataSource;
}
set
{
if (dataSource != value)
{
dataSource = value;
NotifyPropertyChanged("DataSource");
}
}
}
#endregion
#region INotifyPropertyChanged 成员
public void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
public interface IGraphScanCircular
{
///
/// 分区数
///
int BoltCnt { get; set; }
///
/// 手动螺栓数
///
int ManualCnt { get; set; }
///
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
///
bool MPIsRight { get; set; }
///
/// 复位分区号,也就是三角形对应的 分区号
///
double OrgBoltNo { get; set; }
///
/// 第1个手动螺栓 对应于 分区号
///
int BoltNoWithManual1st { get; set; }
///
/// 工艺值
///
int Alarm { get; set; }
///
/// 只能是自动目标值, target 与 alarm 组合使用,工艺%
///
int Target { get; set; }
///
/// 空的数据,定义某个值为空,默认为 99999998
///
int EmptyValue { get; set; }
///
/// 放大倍数, 目标值= Target/放大倍数
///
double Multi { get; set; }
///
/// 标题
///
string Title { get; set; }
///
/// 副标题
///
string Title2 { get; set; }
///
/// 数据源
///
public ObservableCollection DataSource { get; set; }
}
}