252 lines
8.5 KiB
C#
252 lines
8.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
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 CapMachine.Shared.Controls
|
|
{
|
|
/// <summary>
|
|
/// MeterConfig.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class MeterConfig : UserControl
|
|
{
|
|
public MeterConfig()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
//ConstSlopSelectedIndex
|
|
/// <summary>
|
|
/// TabControl选择的Index
|
|
/// </summary>
|
|
public int ConstSlopSelectedIndex
|
|
{
|
|
get
|
|
{
|
|
return (int)base.GetValue(MeterConfig.ConstSlopSelectedIndexProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.ConstSlopSelectedIndexProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty ConstSlopSelectedIndexProperty = DependencyProperty.Register("ConstSlopSelectedIndex", typeof(int), typeof(MeterConfig), new PropertyMetadata(1));
|
|
|
|
|
|
/// <summary>
|
|
/// 常量数据
|
|
/// </summary>
|
|
public double ConstantValue
|
|
{
|
|
get
|
|
{
|
|
return (double)base.GetValue(MeterConfig.ConstantValueProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.ConstantValueProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty ConstantValueProperty = DependencyProperty.Register("ConstantValue", typeof(double), typeof(MeterConfig), new PropertyMetadata(0.0));
|
|
|
|
|
|
/// <summary>
|
|
/// 仪表名称
|
|
/// </summary>
|
|
public string MeterName
|
|
{
|
|
get
|
|
{
|
|
return (string)base.GetValue(MeterConfig.MeterNameProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.MeterNameProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(MeterConfig), new PropertyMetadata("变量"));
|
|
|
|
|
|
//MeterSlopCell
|
|
public object SelectedMeter
|
|
{
|
|
get
|
|
{
|
|
return (MeterSlopCell)base.GetValue(MeterConfig.SelectedMeterProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.SelectedMeterProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty SelectedMeterProperty = DependencyProperty.Register("SelectedMeter", typeof(object), typeof(MeterConfig), new PropertyMetadata(null));
|
|
|
|
|
|
//MeterSlopCell
|
|
public IEnumerable ListMeter
|
|
{
|
|
get
|
|
{
|
|
return (IEnumerable)base.GetValue(MeterConfig.ListMeterProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.ListMeterProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty ListMeterProperty = DependencyProperty.Register("ListMeter", typeof(IEnumerable), typeof(MeterConfig), new PropertyMetadata(null));
|
|
|
|
|
|
/// <summary>
|
|
/// Add 命令
|
|
/// </summary>
|
|
public ICommand AddCommand
|
|
{
|
|
get { return (ICommand)GetValue(AddCommandProperty); }
|
|
set { SetValue(AddCommandProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty AddCommandProperty =
|
|
DependencyProperty.Register("AddCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
/// <summary>
|
|
/// Edit 命令
|
|
/// </summary>
|
|
public ICommand EditCommand
|
|
{
|
|
get { return (ICommand)GetValue(EditCommandProperty); }
|
|
set { SetValue(EditCommandProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty EditCommandProperty =
|
|
DependencyProperty.Register("EditCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
/// <summary>
|
|
/// Delete 命令
|
|
/// </summary>
|
|
public ICommand DeleteCommand
|
|
{
|
|
get { return (ICommand)GetValue(DeleteCommandProperty); }
|
|
set { SetValue(DeleteCommandProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty DeleteCommandProperty =
|
|
DependencyProperty.Register("DeleteCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
|
|
//MeterSelectedChangedCmd
|
|
/// <summary>
|
|
/// MeterSelectedChanged 命令
|
|
/// </summary>
|
|
public ICommand MeterSelectedChangedCmd
|
|
{
|
|
get { return (ICommand)GetValue(MeterSelectedChangedCmdProperty); }
|
|
set { SetValue(MeterSelectedChangedCmdProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty MeterSelectedChangedCmdProperty =
|
|
DependencyProperty.Register("MeterSelectedChangedCmd", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
|
|
/// <summary>
|
|
/// Constant 保存 命令
|
|
/// </summary>
|
|
public ICommand ConstantSaveCommand
|
|
{
|
|
get { return (ICommand)GetValue(ConstantSaveCommandProperty); }
|
|
set { SetValue(ConstantSaveCommandProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty ConstantSaveCommandProperty =
|
|
DependencyProperty.Register("ConstantSaveCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Constant/Slop 常值和斜率切换 命令
|
|
/// </summary>
|
|
public ICommand SwitchConstSlopCommand
|
|
{
|
|
get { return (ICommand)GetValue(SwitchConstSlopCommandProperty); }
|
|
set { SetValue(SwitchConstSlopCommandProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty SwitchConstSlopCommandProperty =
|
|
DependencyProperty.Register("SwitchConstSlopCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
|
|
|
///// <summary>
|
|
///// Constant/Slop 切换命令的参数值
|
|
///// </summary>
|
|
//public bool SwitchConstSlopPar
|
|
//{
|
|
// get
|
|
// {
|
|
// return (bool)base.GetValue(MeterConfig.SwitchConstSlopParProperty);
|
|
// }
|
|
// set
|
|
// {
|
|
// base.SetValue(MeterConfig.SwitchConstSlopParProperty, value);
|
|
// }
|
|
//}
|
|
//public static readonly DependencyProperty SwitchConstSlopParProperty = DependencyProperty.Register("SwitchConstSlopPar", typeof(bool), typeof(MeterConfig), new PropertyMetadata(true));
|
|
|
|
|
|
/// <summary>
|
|
/// 斜率列表总时间
|
|
/// </summary>
|
|
public int TotalSlopTime
|
|
{
|
|
get
|
|
{
|
|
return (int)base.GetValue(MeterConfig.TotalSlopTimeProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.TotalSlopTimeProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty TotalSlopTimeProperty = DependencyProperty.Register("TotalSlopTime", typeof(int), typeof(MeterConfig), new PropertyMetadata(0));
|
|
|
|
|
|
/// <summary>
|
|
/// 斜率循环的次数
|
|
/// </summary>
|
|
public double Cycle
|
|
{
|
|
get
|
|
{
|
|
return (double)base.GetValue(MeterConfig.CycleProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.CycleProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty CycleProperty = DependencyProperty.Register("Cycle", typeof(double), typeof(MeterConfig), new PropertyMetadata(1.0));
|
|
|
|
|
|
/// <summary>
|
|
/// 斜率列表 是否满足要求
|
|
/// </summary>
|
|
public bool IsTimeOk
|
|
{
|
|
get
|
|
{
|
|
return (bool)base.GetValue(MeterConfig.IsTimeOkProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(MeterConfig.IsTimeOkProperty, value);
|
|
}
|
|
}
|
|
public static readonly DependencyProperty IsTimeOkProperty = DependencyProperty.Register("IsTimeOk", typeof(bool), typeof(MeterConfig), new PropertyMetadata(false));
|
|
|
|
}
|
|
}
|