176 lines
4.9 KiB
C#
176 lines
4.9 KiB
C#
using Community;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace ViewModel
|
|
{
|
|
public class HandModel : NotificationObject
|
|
{
|
|
/// <summary>
|
|
/// 序号
|
|
/// </summary>
|
|
public int Number { get; set; }
|
|
|
|
public Label Labels { get; set; }
|
|
|
|
private ShowInfo state;
|
|
/// <summary>
|
|
/// 标签状态
|
|
/// </summary>
|
|
public ShowInfo State
|
|
{
|
|
get { return state; }
|
|
set
|
|
{
|
|
state = value == null ? new ShowInfo() : value;
|
|
RaisePropertyChanged("State");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 气缸
|
|
/// </summary>
|
|
public OutputSignal QiGang { get; set; }
|
|
/// <summary>
|
|
/// 气缸原位
|
|
/// </summary>
|
|
public InputSignal QiGangUp { get; set; }
|
|
/// <summary>
|
|
/// 气缸到位
|
|
/// </summary>
|
|
public InputSignal QiGangDown { get; set; }
|
|
|
|
/// <summary>
|
|
/// 顶升气缸原位
|
|
/// </summary>
|
|
public OutputSignal YDingShengQiGangYW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 顶升气缸动位
|
|
/// </summary>
|
|
public OutputSignal YDingShengQiGangDW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 顶升气缸原位检知
|
|
/// </summary>
|
|
public InputSignal XDingShengQigangYW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 顶升气缸到位检知
|
|
/// </summary>
|
|
public InputSignal XDingShengQigangDW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 伸缩气缸
|
|
/// </summary>
|
|
public OutputSignal YShenSuoQiGangYW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 伸缩气缸
|
|
/// </summary>
|
|
public OutputSignal YShenSuoQiGangDW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 伸缩气缸原位
|
|
/// </summary>
|
|
public InputSignal XShenSuoQigangYW { get; set; }
|
|
|
|
/// <summary>
|
|
/// 伸缩气缸到位
|
|
/// </summary>
|
|
public InputSignal XShenSuoQigangDW { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 真空开关
|
|
/// </summary>
|
|
public OutputSignal VacuumSwitch { get; set; }
|
|
|
|
/// <summary>
|
|
/// 真空破开关
|
|
/// </summary>
|
|
public OutputSignal VacuumPoSwitch { get; set; }
|
|
|
|
/// <summary>
|
|
/// 真空捡知
|
|
/// </summary>
|
|
public InputSignal VacuumCheck { get; set; }
|
|
|
|
/// <summary>
|
|
/// 吸嘴放料点位1
|
|
/// </summary>
|
|
public RobotPoint PutProPoint1 { get; set; }
|
|
/// <summary>
|
|
/// 吸嘴放料点位2
|
|
/// </summary>
|
|
public RobotPoint PutProPoint2 { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 吸嘴取料点位1
|
|
/// </summary>
|
|
public RobotPoint TakeProPoint1 { get; set; }
|
|
/// <summary>
|
|
/// 吸嘴取料点位2
|
|
/// </summary>
|
|
public RobotPoint TakeProPoint2 { get; set; }
|
|
|
|
public DateTime CheckVacuumTime { get; set; }
|
|
|
|
public double OfficeX { get; set; }
|
|
public double OfficeY { get; set; }
|
|
|
|
public double OfficeU { get; set; }
|
|
|
|
/// <summary>
|
|
/// Label显示控件对象
|
|
/// </summary>
|
|
public HandModel()
|
|
{
|
|
State = new ShowInfo();
|
|
Labels = new Label();
|
|
//数据样式
|
|
Labels.Style = (Style)MyMessageBox.MetroWin.FindResource("Mylabel1");//LabelStyle 这个样式是引用的资源文件中的样式名称
|
|
//绑定背景颜色
|
|
Labels.SetBinding(Label.BackgroundProperty, new Binding() { Source = this, Path = new PropertyPath("State.StatusBackground"), Mode = BindingMode.TwoWay });
|
|
//绑定内容
|
|
Labels.SetBinding(Label.ContentProperty, new Binding() { Source = this, Path = new PropertyPath("State.StatuInfo"), Mode = BindingMode.TwoWay });
|
|
|
|
Labels.MouseDoubleClick += Labels_MouseDoubleClick; //增加鼠标双击事件
|
|
Labels.Margin = new Thickness(1); //设置边距
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Label的双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Labels_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
{
|
|
//如果为绿色 则不允许改其他颜色
|
|
if (State.StatusBackground == ColorStr.White)
|
|
{
|
|
State.StatusBackground = ColorStr.Blue;
|
|
}
|
|
else if (State.StatusBackground == ColorStr.Blue)
|
|
{
|
|
State.StatusBackground = ColorStr.Green;
|
|
|
|
}
|
|
else
|
|
{
|
|
State.StatusBackground = ColorStr.White;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|