173 lines
4.9 KiB
C#
173 lines
4.9 KiB
C#
using Community;
|
|
using Model;
|
|
using Model.MotionControl;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
|
|
namespace ViewModel
|
|
{
|
|
#region 自定义Label控件类
|
|
/// <summary>
|
|
/// 自定义Label控件类
|
|
/// </summary>
|
|
public class MyLabel : NotificationObject
|
|
{
|
|
/// <summary>
|
|
/// 序号
|
|
/// </summary>
|
|
public int Number { get; set; }
|
|
|
|
private string myColor;
|
|
/// <summary>
|
|
/// 表示颜色
|
|
/// </summary>
|
|
public string MyColor
|
|
{
|
|
get { return myColor; }
|
|
set
|
|
{
|
|
myColor = value;
|
|
this.RaisePropertyChanged("MyColor");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 对于的Tray名称
|
|
/// </summary>
|
|
public string TrayName { get; set; }
|
|
public RobotPoint TakePutPoint { get; set; }
|
|
public RobotPoint VisonPoint { get; set; }
|
|
public Label Labels { get; set; }
|
|
|
|
private string labelConten;
|
|
/// <summary>
|
|
/// label内容
|
|
/// </summary>
|
|
public string LabelConten
|
|
{
|
|
get { return labelConten; }
|
|
set
|
|
{
|
|
labelConten = value;
|
|
this.RaisePropertyChanged("LabelConten");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 吸嘴编号(点位归属的那个吸嘴)
|
|
/// </summary>
|
|
public int XizuiNumber { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 吸嘴1取放料点位
|
|
/// </summary>
|
|
public RobotPoint TakePutPoint1 { get; set; }
|
|
/// <summary>
|
|
/// 吸嘴2取放料点位
|
|
/// </summary>
|
|
public RobotPoint TakePutPoint2 { get; set; }
|
|
/// <summary>
|
|
/// 取料点
|
|
/// </summary>
|
|
public RobotPoint TakePoint { get; set; }
|
|
/// <summary>
|
|
/// 放料点
|
|
/// </summary>
|
|
public RobotPoint PutPoint { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 第一个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M1 { get; set; }
|
|
/// <summary>
|
|
/// 第二个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M2 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 第三个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M3 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 第四个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M4 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 第五个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M5 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 第六个吸嘴贴标点
|
|
/// </summary>
|
|
public MotionPointModel Point_M6 { get; set; }
|
|
|
|
private ProductModel product;
|
|
/// <summary>
|
|
/// Mylabel对应的产品对象
|
|
/// </summary>
|
|
public ProductModel Product
|
|
{
|
|
get { return product; }
|
|
set { product = value; RaisePropertyChanged("Product"); }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Label显示控件对象
|
|
/// </summary>
|
|
public MyLabel()
|
|
{
|
|
Product = new ProductModel();
|
|
Labels = new Label();
|
|
MyColor = ColorStr.White;
|
|
//LabelConten ="11";
|
|
//绑定背景颜色
|
|
Labels.SetBinding(Label.BackgroundProperty, new Binding() { Source = this, Path = new PropertyPath("Product.StateColour"), Mode = BindingMode.TwoWay });
|
|
//绑定内容
|
|
// Labels.SetBinding(Label.ContentProperty, new Binding() { Source = this, Path = new PropertyPath("Product.SnCode"), Mode = BindingMode.TwoWay });
|
|
Labels.SetBinding(Label.ContentProperty, new Binding() { Source = this, Path = new PropertyPath("LabelConten"), Mode = BindingMode.TwoWay });
|
|
Labels.MouseDoubleClick += Labels_MouseDoubleClick; //增加鼠标双击事件
|
|
Labels.Margin = new Thickness(1); //设置边距
|
|
Labels.HorizontalContentAlignment = HorizontalAlignment.Center;
|
|
Labels.VerticalContentAlignment = VerticalAlignment.Center;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Label的双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Labels_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
{
|
|
|
|
if (Product.StateColour == ColorStr.Green)
|
|
{
|
|
Product.StateColour = ColorStr.White;
|
|
}
|
|
else if (Product.StateColour == ColorStr.White)
|
|
{
|
|
Product.StateColour = ColorStr.Blue;
|
|
}
|
|
else
|
|
{
|
|
Product.StateColour = ColorStr.Green;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
#region Tray盘类
|
|
|
|
#endregion
|
|
|
|
}
|