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
{
    /// <summary>
    /// UserControl1.xaml 的交互逻辑
    /// </summary>
    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<int> dataSource;
        public ObservableCollection<int> 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
    {
        /// <summary>
        /// 分区数
        /// </summary>
        int BoltCnt { get; set; }

        /// <summary>
        /// 手动螺栓数
        /// </summary>
        int ManualCnt { get; set; }

        /// <summary>
        /// 测厚仪测量点位置方向：Left， Right （也就是三角形在左还是右）
        /// </summary>
        bool MPIsRight { get; set; }

        /// <summary>
        /// 复位分区号，也就是三角形对应的 分区号
        /// </summary>
        double OrgBoltNo { get; set; }

        /// <summary>
        ///  第1个手动螺栓 对应于 分区号
        /// </summary>
        int BoltNoWithManual1st { get; set; }

        /// <summary>
        /// 工艺值
        /// </summary>
        int Alarm { get; set; }

        /// <summary>
        /// 只能是自动目标值,  target 与 alarm 组合使用，工艺%
        /// </summary>
        int Target { get; set; }

        /// <summary>
        /// 空的数据，定义某个值为空，默认为 99999998
        /// </summary>
        int EmptyValue { get; set; }

        /// <summary>
        /// 放大倍数, 目标值= Target/放大倍数
        /// </summary>
        double Multi { get; set; }

        /// <summary>
        ///  标题
        /// </summary>
        string Title { get; set; }

        /// <summary>
        /// 副标题
        /// </summary>
        string Title2 { get; set; }

        /// <summary>
        /// 数据源
        /// </summary>
        public ObservableCollection<int> DataSource { get; set; }
    }
}
