using IMCS.Config; using IMCS.DefaultList; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace IMCS.Componen { public partial class Uctl_OContro2 : UserControlBase { public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList(); Uctl_OComponen1 uctl_OComponen1 = new Uctl_OComponen1(); //public override event Delegate_MouseDownTag UserControlMouseDown; //public override event Delegate_DragDropTag UserControlDragDropTag; /// /// 是否是AGV接驳位的高位 /// public bool UserAgvH { get; set; } = false; public Uctl_OContro2() { InitializeComponent(); this.Load += (s, e) => { //this.lb_Name.BackColor = System.Drawing.Color.Green; lb_Name.TextAlign = ContentAlignment.MiddleLeft; this. deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged; this.pan_left_top.MouseDown += Pan_left_top_Click; this.pan_left_cen.MouseDown += Pan_left_top_Click; this.pan_left_bottom.MouseDown += Pan_left_top_Click; this.pan_right_top.MouseDown += Pan_right_top_Click; this.pan_right_bottom.MouseDown += Pan_right_top_Click; this.pan_right_cen.MouseDown += Pan_right_top_Click; this.pan_left_top.DragDrop += Pan_left_top_DragDrop; this.pan_left_cen.DragDrop += Pan_left_top_DragDrop; this.pan_left_bottom.DragDrop += Pan_left_top_DragDrop; this.pan_right_top.DragDrop += Pan_right_top_DragDrop; this.pan_right_bottom.DragDrop += Pan_right_top_DragDrop; this.pan_right_cen.DragDrop += Pan_right_top_DragDrop; this.pan_left.Click += (t, k) => { EventMoudeDown(-1); }; this.pan_right.Click += (t, k) => { }; }; } private void Pan_right_top_DragDrop(object sender, DragEventArgs e) { if (UserAgvH) { UserTag = 121; } else { UserTag = 119; } EventMoudeDown(UserTag); } private void Pan_left_top_DragDrop(object sender, DragEventArgs e) { if (UserAgvH) { UserTag = 122; } else { UserTag = 120; } EventMoudeDrag(UserTag); } private void Pan_right_top_Click(object sender, EventArgs e) { if (UserAgvH) { UserTag = 121; } else { UserTag = 119; } EventMoudeDrag(UserTag); } private void Pan_left_top_Click(object sender, EventArgs e) { if (UserAgvH) { UserTag = 122; } else { UserTag = 120; } EventMoudeDown(UserTag); } //public override void EventMoudeDown(int value) //{ // if (UserControlMouseDown != null) // { // UserControlMouseDown(value); // } // base.EventMoudeDown(value); //} private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e) { DeviceStateDefaultList dl = sender as DeviceStateDefaultList; switch (e.PropertyName) { case "Device_OnLine": break; case "Device_ConnectionMes": break; case "Device_Name": this.lb_Name.BeginInvoke(new Action(() => { this.lb_Name.Text = dl.Device_Name; })); break; case "Device_Pan": if (dl.Device_Pan.Equals(EnumPlateNum.Plate_One)) { this.pan_right.BackColor = System.Drawing.Color.FromArgb(223, 223, 223); this.pan_right_bottom.Visible = false; this.pan_right_cen.Visible = false; this.pan_right_top.Visible = false; } else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Zero)) { this.pan_left.Visible = false; this.pan_right.Visible = false; this.pan_Ful.BackColor = System.Drawing.Color.FromArgb(223, 223, 223); } else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Two)) { } break; case "Device_Runing": break; } } } }