diff --git a/Rs.Controls/RsTray.Designer.cs b/Rs.Controls/RsTray.Designer.cs
index dfac127..250592a 100644
--- a/Rs.Controls/RsTray.Designer.cs
+++ b/Rs.Controls/RsTray.Designer.cs
@@ -39,6 +39,8 @@
this.设置无料ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.设置有料ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.禁用ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.scanFailToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.selectedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
@@ -91,7 +93,9 @@
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.设置无料ToolStripMenuItem,
this.设置有料ToolStripMenuItem,
- this.禁用ToolStripMenuItem});
+ this.禁用ToolStripMenuItem,
+ this.scanFailToolStripMenuItem,
+ this.selectedToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1");
//
@@ -113,6 +117,18 @@
resources.ApplyResources(this.禁用ToolStripMenuItem, "禁用ToolStripMenuItem");
this.禁用ToolStripMenuItem.Click += new System.EventHandler(this.禁用ToolStripMenuItem_Click);
//
+ // scanFailToolStripMenuItem
+ //
+ this.scanFailToolStripMenuItem.Name = "scanFailToolStripMenuItem";
+ resources.ApplyResources(this.scanFailToolStripMenuItem, "scanFailToolStripMenuItem");
+ this.scanFailToolStripMenuItem.Click += new System.EventHandler(this.scanFailToolStripMenuItem_Click);
+ //
+ // selectedToolStripMenuItem
+ //
+ this.selectedToolStripMenuItem.Name = "selectedToolStripMenuItem";
+ resources.ApplyResources(this.selectedToolStripMenuItem, "selectedToolStripMenuItem");
+ this.selectedToolStripMenuItem.Click += new System.EventHandler(this.selectedToolStripMenuItem_Click);
+ //
// RsTray
//
resources.ApplyResources(this, "$this");
@@ -139,5 +155,7 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.ToolStripMenuItem scanFailToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem selectedToolStripMenuItem;
}
}
diff --git a/Rs.Controls/RsTray.cs b/Rs.Controls/RsTray.cs
index 4a468ef..edc66b0 100644
--- a/Rs.Controls/RsTray.cs
+++ b/Rs.Controls/RsTray.cs
@@ -49,12 +49,38 @@ namespace Rs.Controls
public enum ESlotStatus
{
+ ///
+ /// 有料
+ ///
Have,
+ ///
+ /// 无料
+ ///
NotHave,
+ ///
+ /// 测试OK
+ ///
Ok,
+ ///
+ /// 测试NG
+ ///
Ng,
+ ///
+ /// 禁用
+ ///
Disable,
- Null
+ ///
+ ///
+ ///
+ Null,
+ ///
+ /// 扫码失败
+ ///
+ ScanFail,
+ ///
+ /// 被选择
+ ///
+ Selected
}
public partial class RsTray : UserControl
@@ -197,6 +223,31 @@ namespace Rs.Controls
return null;
}
+ public TraySlot GetSlot(ESlotStatus[] status, bool reverse = false)
+ {
+ if (reverse)
+ {
+ for (int row = 0; row < RowNum; row++)
+ {
+ for (int col = ColumnNum; col > 0; col--)
+ {
+ int index = row * (ColumnNum) + col;
+ if (status.Contains( traySlotsDic[index].SlotStatus))
+ return traySlotsDic[index];
+ }
+ }
+ }
+ else
+ {
+ foreach (KeyValuePair kv in traySlotsDic)
+ {
+ if (status.Contains(kv.Value.SlotStatus))
+ return kv.Value;
+ }
+ }
+ return null;
+ }
+
///
/// 根据穴位的状态获取穴位
///
@@ -724,6 +775,34 @@ namespace Rs.Controls
{
UpdateSlotPos();
}
+
+ private void scanFailToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ChangeSlotStatus(ESlotStatus.ScanFail);
+ List slots = new List();
+ foreach (KeyValuePair kvSlot in traySlotsDic)
+ {
+ if (drawRect.IntersectsWith(kvSlot.Value.Bound))
+ {
+ slots.Add(kvSlot.Value);
+ }
+ }
+ DrawTrayAfterEvent?.Invoke(this, ESlotStatus.ScanFail, slots);
+ }
+
+ private void selectedToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ChangeSlotStatus(ESlotStatus.Selected);
+ List slots = new List();
+ foreach (KeyValuePair kvSlot in traySlotsDic)
+ {
+ if (drawRect.IntersectsWith(kvSlot.Value.Bound))
+ {
+ slots.Add(kvSlot.Value);
+ }
+ }
+ DrawTrayAfterEvent?.Invoke(this, ESlotStatus.Selected, slots);
+ }
}
///
@@ -805,6 +884,12 @@ namespace Rs.Controls
case ESlotStatus.Null:
g.FillRectangle(new SolidBrush(Color.FromArgb(11, 16, 36)), Bound.X, Bound.Y, Bound.Width - 1, Bound.Height - 1);
break;
+ case ESlotStatus.ScanFail:
+ g.FillRectangle(new SolidBrush(Color.FromArgb(235, 23, 110)), Bound.X, Bound.Y, Bound.Width - 1, Bound.Height - 1);
+ break;
+ case ESlotStatus.Selected:
+ g.FillRectangle(new SolidBrush(Color.FromArgb(255, 0, 0)), Bound.X, Bound.Y, Bound.Width - 1, Bound.Height - 1);
+ break;
default:
break;
}
diff --git a/Rs.Controls/RsTray.resx b/Rs.Controls/RsTray.resx
index c84dc8b..1722cc9 100644
--- a/Rs.Controls/RsTray.resx
+++ b/Rs.Controls/RsTray.resx
@@ -282,8 +282,20 @@
Disable
+
+ 134, 22
+
+
+ ScanFail
+
+
+ 134, 22
+
+
+ Selected
+
- 135, 70
+ 135, 114
contextMenuStrip1
@@ -318,6 +330,18 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ scanFailToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ selectedToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
RsTray