From 753b5add58defa5c09015308efb81bcaea0ebe91 Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期六, 04 七月 2020 12:36:55 +0800 Subject: [PATCH] 修改板卡操作配置基类复数化 --- src/Bro.Device.GTSCard/GTSCardDriver.cs | 32 ++-- src/Bro.M071.Process/UI/M071_MainForm.cs | 63 +++++++- src/Bro.Common.Device/DeviceBase/MotionCardBase.cs | 33 +++- src/Bro.M071.Process/M071Process_MotionCard.cs | 2 src/Bro.M071.Process/UI/M071_MainForm.Designer.cs | 80 ++++++++++ src/Bro.UI.Config/MenuForms/FrmOperation.resx | 4 src/Bro.UI.Config/MainFrm.cs | 17 +- src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs | 24 +- src/Bro.UI.Config/MenuForms/FrmConfig.cs | 2 src/Bro.M071.Process/M071Process.cs | 19 -- src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs | 39 +++++ src/Bro.M071.Process/UI/M071_ShortcutFrm.cs | 22 +++ src/Bro.UI.Config/MainFrm.Designer.cs | 1 src/Bro.M071.Process/Bro.M071.Process.csproj | 6 src/Bro.UI.Config/MenuForms/FrmOperation.cs | 15 +- src/Bro.M071.Process/M071Config.cs | 18 ++ 16 files changed, 292 insertions(+), 85 deletions(-) diff --git a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs index 2ea2a37..2091140 100644 --- a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs +++ b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs @@ -126,7 +126,6 @@ public List<IMonitorSet> GetAllMonitorSet() { WarningSetCollection.ForEach(m => m.Source = this.Name); - MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id); return MonitorSetCollection; } @@ -135,6 +134,20 @@ [Device("MotionCardBase", "鏉垮崱鎿嶄綔閰嶇疆鍩虹被", EnumHelper.DeviceAttributeType.OperationConfig)] public class MotionCardOperationConfigBase : OperationConfigBase, IComplexDisplay + { + [Category("鏉垮崱鎿嶄綔")] + [Description("鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎锛屼緷娆℃墽琛�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<MotionCardOperationConfigBase>), typeof(UITypeEditor))] + public List<MotionCardOperationSet> OperationCollection { get; set; } = new List<MotionCardOperationSet>(); + + public string GetDisplayText() + { + return string.Join(" ", OperationCollection.Select(u => u.GetDisplayText())); + } + } + + public class MotionCardOperationSet : IComplexDisplay { [Category("IO鎿嶄綔閰嶇疆")] [DisplayName("IO棰勬鏌ュ畾涔夐泦鍚�")] @@ -219,15 +232,15 @@ } } - [Device("MotionCardOperationConfigCollection", "鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎", EnumHelper.DeviceAttributeType.OperationConfig)] - public class MotionCardOperationConfigCollection : OperationConfigBase - { - [Category("澶嶄綅鎿嶄綔")] - [Description("鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎锛屼緷娆℃墽琛�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<MotionCardOperationConfigBase>), typeof(UITypeEditor))] - public List<MotionCardOperationConfigBase> MotionCardOpsCollection { get; set; } = new List<MotionCardOperationConfigBase>(); - } + //[Device("MotionCardOperationConfigCollection", "鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎", EnumHelper.DeviceAttributeType.OperationConfig)] + //public class MotionCardOperationConfigCollection : OperationConfigBase + //{ + // [Category("澶嶄綅鎿嶄綔")] + // [Description("鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎锛屼緷娆℃墽琛�")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<MotionCardOperationConfigBase>), typeof(UITypeEditor))] + // public List<MotionCardOperationConfigBase> MotionCardOpsCollection { get; set; } = new List<MotionCardOperationConfigBase>(); + //} public class IORefrenceItemCollectionEditor : CollectionEditor { diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs index 0368c10..04c2bf1 100644 --- a/src/Bro.Device.GTSCard/GTSCardDriver.cs +++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs @@ -164,22 +164,22 @@ /// <returns>杩愬姩鎺у埗+鍋滄鍒ゆ柇</returns> public override ResponseMessage MoveToPoint(IOperationConfig opConfig) { - bool resultOK = false; - var gtsOperationConfig = opConfig as GTSCardOperationConfig; - List<Task<bool>> taskList = new List<Task<bool>>(); - //TaskFactory factory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); - // 濡傛灉鏄涓酱鐨勮繍鍔� 绛夋瘡涓酱杩愬姩缁撴潫 - foreach (var movingOp in gtsOperationConfig.MovingOps) - { - //var task = factory.StartNew<bool>((op) => - //{ - // return SingleAxisMoving(op as MovingOption); - //}, movingOp); - var task = SingleAxisMoving(movingOp); - taskList.Add(task); - } - Task.WaitAll(taskList.ToArray()); - resultOK = taskList.All(u => u.GetAwaiter().GetResult()); + //bool resultOK = false; + //var gtsOperationConfig = opConfig as GTSCardOperationConfig; + //List<Task<bool>> taskList = new List<Task<bool>>(); + ////TaskFactory factory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); + //// 濡傛灉鏄涓酱鐨勮繍鍔� 绛夋瘡涓酱杩愬姩缁撴潫 + //foreach (var movingOp in gtsOperationConfig.MovingOps) + //{ + // //var task = factory.StartNew<bool>((op) => + // //{ + // // return SingleAxisMoving(op as MovingOption); + // //}, movingOp); + // var task = SingleAxisMoving(movingOp); + // taskList.Add(task); + //} + //Task.WaitAll(taskList.ToArray()); + //resultOK = taskList.All(u => u.GetAwaiter().GetResult()); //return resultOK; throw new NotImplementedException(); diff --git a/src/Bro.M071.Process/Bro.M071.Process.csproj b/src/Bro.M071.Process/Bro.M071.Process.csproj index 08b6346..e251945 100644 --- a/src/Bro.M071.Process/Bro.M071.Process.csproj +++ b/src/Bro.M071.Process/Bro.M071.Process.csproj @@ -120,6 +120,12 @@ <Compile Include="UI\M071_MainForm.Designer.cs"> <DependentUpon>M071_MainForm.cs</DependentUpon> </Compile> + <Compile Include="UI\M071_ShortcutFrm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="UI\M071_ShortcutFrm.Designer.cs"> + <DependentUpon>M071_ShortcutFrm.cs</DependentUpon> + </Compile> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> diff --git a/src/Bro.M071.Process/M071Config.cs b/src/Bro.M071.Process/M071Config.cs index 84af1e8..aa06147 100644 --- a/src/Bro.M071.Process/M071Config.cs +++ b/src/Bro.M071.Process/M071Config.cs @@ -77,5 +77,23 @@ [Description("鍗曢敭鍥剧墖淇濆瓨鐩綍璺緞")] [Editor(typeof(FoldDialogEditor),typeof(UITypeEditor))] public string ImageSaveFolder { get; set; } = ""; + + [Category("灞忚斀閰嶇疆")] + [Description("true锛氬睆钄藉畨鍏ㄩ棬 false锛氬惎鐢ㄥ畨鍏ㄩ棬")] + [ReadOnly(true)] + public bool IsSafetyDoorBlocked { get; set; } = false; + + [Category("灞忚斀閰嶇疆")] + [Description("true锛氬睆钄藉畨鍏ㄥ厜绾� false锛氬惎鐢ㄥ畨鍏ㄥ厜绾�")] + [ReadOnly(true)] + public bool IsSafetyBeamBlocked { get; set; } = false; + + [Category("灞忚斀閰嶇疆")] + [Description("true锛氬睆钄借渹楦e櫒 false锛氬惎鐢ㄨ渹楦e櫒")] + public bool IsBeepBlocked { get; set; } = false; + + [Category("灞忚斀閰嶇疆")] + [Description("true锛氱姝㈡墜鍔ㄨ緭鍏ユ潯鐮� false锛氬厑璁告墜鍔ㄨ緭鍏ユ潯鐮�")] + public bool IsBarcodeManulInputBlocked { get; set; } = true; } } diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index b5235b2..65f74a9 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -33,7 +33,7 @@ #region 浜嬩欢 public event Action OnMeasureStart; - public event Action<string> OnBarcodeChanged; + public event Action OnClearBarcode; public event Action<IShapeElement> OnElementUpdated; #endregion @@ -51,7 +51,7 @@ /// </summary> private void CheckMachineState() { - throw new NotImplementedException(); + //throw new NotImplementedException(); } private void InitialSetting() @@ -150,19 +150,7 @@ //} #endregion - private string barCode = ""; - public string BarCode - { - get => barCode; - set - { - if (barCode != value) - { - barCode = value; - OnBarcodeChanged?.Invoke(value); - } - } - } + public string BarCode { get; set; } List<ProductionMeasurement> productionList = new List<ProductionMeasurement>(); @@ -171,6 +159,7 @@ { if (string.IsNullOrWhiteSpace(BarCode)) { + OnClearBarcode?.Invoke(); throw new ProcessException("鏈緭鍏ヤ骇鍝佹潯鐮侊紝璇峰嬁寮�濮嬫祴閲�"); } diff --git a/src/Bro.M071.Process/M071Process_MotionCard.cs b/src/Bro.M071.Process/M071Process_MotionCard.cs index a0f31eb..514b46d 100644 --- a/src/Bro.M071.Process/M071Process_MotionCard.cs +++ b/src/Bro.M071.Process/M071Process_MotionCard.cs @@ -116,7 +116,7 @@ // motionCard.Run(opConfig); //} - MotionCardDefaultRun("FullReset", ref opConfig, ref invokeDevice); + //MotionCardDefaultRun("FullReset", ref opConfig, ref invokeDevice); return new ProcessResponse(true); } diff --git a/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs b/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs index 996ca15..b83b97d 100644 --- a/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs +++ b/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs @@ -33,6 +33,11 @@ this.tsmiShowToolBar = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiShowStatusBar = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiShowEditor = new System.Windows.Forms.ToolStripMenuItem(); + this.lblCT = new System.Windows.Forms.Label(); + this.txtBarcode = new System.Windows.Forms.TextBox(); + this.lblProductionState = new System.Windows.Forms.Label(); + this.lblMachineState = new System.Windows.Forms.Label(); + this.plImage = new System.Windows.Forms.Panel(); this.tscEditLocation = new System.Windows.Forms.ToolStripContainer(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.btnConfirmEdit = new System.Windows.Forms.Button(); @@ -82,6 +87,61 @@ this.tsmiShowEditor.Size = new System.Drawing.Size(148, 22); this.tsmiShowEditor.Text = "缂栬緫鏄剧ず鐐逛綅"; this.tsmiShowEditor.CheckedChanged += new System.EventHandler(this.tsmiShowEditor_CheckedChanged); + // + // lblCT + // + this.lblCT.AutoSize = true; + this.lblCT.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134))); + this.lblCT.Location = new System.Drawing.Point(464, 19); + this.lblCT.Name = "lblCT"; + this.lblCT.Size = new System.Drawing.Size(35, 14); + this.lblCT.TabIndex = 4; + this.lblCT.Text = "XXXX"; + // + // txtBarcode + // + this.txtBarcode.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134))); + this.txtBarcode.Location = new System.Drawing.Point(138, 13); + this.txtBarcode.Name = "txtBarcode"; + this.txtBarcode.Size = new System.Drawing.Size(261, 24); + this.txtBarcode.TabIndex = 3; + this.txtBarcode.Text = "BARCODE"; + this.txtBarcode.TextChanged += new System.EventHandler(this.txtBarcode_TextChanged); + // + // lblProductionState + // + this.lblProductionState.AutoSize = true; + this.lblProductionState.BackColor = System.Drawing.Color.Lime; + this.lblProductionState.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((byte)(134))); + this.lblProductionState.ForeColor = System.Drawing.Color.White; + this.lblProductionState.Location = new System.Drawing.Point(405, 13); + this.lblProductionState.Name = "lblProductionState"; + this.lblProductionState.Size = new System.Drawing.Size(39, 24); + this.lblProductionState.TabIndex = 2; + this.lblProductionState.Text = "OK"; + // + // lblMachineState + // + this.lblMachineState.AutoSize = true; + this.lblMachineState.BackColor = System.Drawing.Color.Lime; + this.lblMachineState.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((byte)(134))); + this.lblMachineState.ForeColor = System.Drawing.Color.White; + this.lblMachineState.Location = new System.Drawing.Point(22, 12); + this.lblMachineState.Name = "lblMachineState"; + this.lblMachineState.Size = new System.Drawing.Size(79, 24); + this.lblMachineState.TabIndex = 2; + this.lblMachineState.Text = "READY"; + // + // plImage + // + this.plImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.plImage.ContextMenuStrip = this.contextMenuStrip1; + this.plImage.Location = new System.Drawing.Point(1, 47); + this.plImage.Name = "plImage"; + this.plImage.Size = new System.Drawing.Size(796, 304); + this.plImage.TabIndex = 1; // // tscEditLocation // @@ -159,7 +219,7 @@ // this.splitContainer1.Panel2.Controls.Add(this.propGridKeyIndicator); this.splitContainer1.Size = new System.Drawing.Size(203, 284); - this.splitContainer1.SplitterDistance = 164; + this.splitContainer1.SplitterDistance = 163; this.splitContainer1.TabIndex = 1; // // lvMeasures @@ -171,7 +231,7 @@ this.lvMeasures.Location = new System.Drawing.Point(0, 0); this.lvMeasures.MultiSelect = false; this.lvMeasures.Name = "lvMeasures"; - this.lvMeasures.Size = new System.Drawing.Size(203, 164); + this.lvMeasures.Size = new System.Drawing.Size(203, 163); this.lvMeasures.TabIndex = 0; this.lvMeasures.UseCompatibleStateImageBehavior = false; this.lvMeasures.View = System.Windows.Forms.View.List; @@ -182,7 +242,7 @@ this.propGridKeyIndicator.Dock = System.Windows.Forms.DockStyle.Fill; this.propGridKeyIndicator.Location = new System.Drawing.Point(0, 0); this.propGridKeyIndicator.Name = "propGridKeyIndicator"; - this.propGridKeyIndicator.Size = new System.Drawing.Size(203, 116); + this.propGridKeyIndicator.Size = new System.Drawing.Size(203, 117); this.propGridKeyIndicator.TabIndex = 0; this.propGridKeyIndicator.ToolbarVisible = false; // @@ -191,10 +251,16 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 351); - this.ContextMenuStrip = this.contextMenuStrip1; + this.Controls.Add(this.lblCT); + this.Controls.Add(this.txtBarcode); + this.Controls.Add(this.lblProductionState); + this.Controls.Add(this.lblMachineState); + this.Controls.Add(this.plImage); this.Controls.Add(this.tscEditLocation); + this.KeyPreview = true; this.Name = "M071_MainForm"; this.Text = "M071_MainForm"; + this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.M071_MainForm_KeyUp); this.contextMenuStrip1.ResumeLayout(false); this.tscEditLocation.ContentPanel.ResumeLayout(false); this.tscEditLocation.ResumeLayout(false); @@ -205,6 +271,7 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -221,5 +288,10 @@ private System.Windows.Forms.ListView lvMeasures; private System.Windows.Forms.ToolStripMenuItem tsmiShowToolBar; private System.Windows.Forms.ToolStripMenuItem tsmiShowStatusBar; + private System.Windows.Forms.Panel plImage; + private System.Windows.Forms.Label lblMachineState; + private System.Windows.Forms.Label lblProductionState; + private System.Windows.Forms.TextBox txtBarcode; + private System.Windows.Forms.Label lblCT; } } \ No newline at end of file diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs index 2ec9284..97904b6 100644 --- a/src/Bro.M071.Process/UI/M071_MainForm.cs +++ b/src/Bro.M071.Process/UI/M071_MainForm.cs @@ -12,7 +12,7 @@ namespace Bro.M071.Process.UI { - [MenuNode("M071_MainForm", "閿洏妫�娴嬩富鐣岄潰", 3, "M071Node", true)] + [MenuNode("M071_MainForm", "杩愯鐣岄潰", 1, "M071Node", true)] public partial class M071_MainForm : MenuFrmBase { Canvas cvImage = new Canvas(); @@ -26,7 +26,7 @@ tsmiShowStatusBar.Checked = cvImage.IsShowStatusBar = false; tsmiShowToolBar.Checked = cvImage.IsShowToolBar = false; cvImage.Dock = DockStyle.Fill; - this.Controls.Add(cvImage); + plImage.Controls.Add(cvImage); tscEditLocation.Visible = tsmiShowEditor.Checked = false; } @@ -66,17 +66,14 @@ item.Tag = u.Id; lvMeasures.Items.Add(item); }); - } - - private void lvMeasures_SelectedIndexChanged(object sender, EventArgs e) - { - if (lvMeasures.SelectedItems.Count <= 0) - return; - var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString()); - propGridKeyIndicator.SelectedObject = ele; + txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked; + + (Process as M071Process).OnClearBarcode -= M071_MainForm_OnClearBarcode; + (Process as M071Process).OnClearBarcode += M071_MainForm_OnClearBarcode; } + #region 鍥剧墖鍖哄彸閿彍鍗� private void tsmiShowToolBar_CheckedChanged(object sender, EventArgs e) { cvImage.IsShowToolBar = tsmiShowToolBar.Checked; @@ -90,6 +87,18 @@ private void tsmiShowEditor_CheckedChanged(object sender, EventArgs e) { tscEditLocation.Visible = tsmiShowEditor.Checked; + tscEditLocation.BringToFront(); + } + #endregion + + #region 鏍囩缂栬緫鍖� + private void lvMeasures_SelectedIndexChanged(object sender, EventArgs e) + { + if (lvMeasures.SelectedItems.Count <= 0) + return; + + var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString()); + propGridKeyIndicator.SelectedObject = ele; } private void btnCancelEdit_Click(object sender, EventArgs e) @@ -125,5 +134,39 @@ MessageBox.Show("鏍囩淇敼瀹屾垚"); } + #endregion + + #region 涓婃柟鐘舵�佸尯 + + #region 鏉$爜 + string _barcode = ""; + private void M071_MainForm_KeyUp(object sender, KeyEventArgs e) + { + string keyStr = e.KeyCode.ToString(); + if (keyStr.Length == 1) + { + _barcode += keyStr.ToUpper(); + } + + if (e.KeyValue == 13) + { + txtBarcode.Text = _barcode; + _barcode = ""; + } + } + + private void txtBarcode_TextChanged(object sender, EventArgs e) + { + (Process as M071Process).BarCode = txtBarcode.Text.Trim(); + } + + private void M071_MainForm_OnClearBarcode() + { + txtBarcode.BeginInvoke(new Action(() => txtBarcode.Clear())); + } + #endregion + + #endregion + } } diff --git a/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs b/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs new file mode 100644 index 0000000..6ed449b --- /dev/null +++ b/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs @@ -0,0 +1,39 @@ +锘縩amespace Bro.M071.Process.UI +{ + partial class M071_ShortcutFrm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "M071_ShortcutFrm"; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs b/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs new file mode 100644 index 0000000..245d16d --- /dev/null +++ b/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs @@ -0,0 +1,22 @@ +锘縰sing Bro.UI.Model.Winform; +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 Bro.M071.Process.UI +{ + [MenuNode("M071_ShortcutFrm", "蹇嵎鎿嶄綔", 2, "M071Node", true)] + public partial class M071_ShortcutFrm : MenuFrmBase + { + public M071_ShortcutFrm() + { + InitializeComponent(); + } + } +} diff --git a/src/Bro.UI.Config/MainFrm.Designer.cs b/src/Bro.UI.Config/MainFrm.Designer.cs index 86203a8..925f0ff 100644 --- a/src/Bro.UI.Config/MainFrm.Designer.cs +++ b/src/Bro.UI.Config/MainFrm.Designer.cs @@ -197,6 +197,7 @@ this.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.IsMdiContainer = true; + this.KeyPreview = true; this.MainMenuStrip = this.menuMain; this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.Name = "MainFrm"; diff --git a/src/Bro.UI.Config/MainFrm.cs b/src/Bro.UI.Config/MainFrm.cs index a3b3e18..e7940f5 100644 --- a/src/Bro.UI.Config/MainFrm.cs +++ b/src/Bro.UI.Config/MainFrm.cs @@ -32,7 +32,7 @@ VisualStudioToolStripExtender extender = new VisualStudioToolStripExtender(); extender.SetStyle(menuMain, VisualStudioToolStripExtender.VsVersion.Vs2015, theme); - + InitialMenu(MenuFormFactory.MenuFrmTypeDict, ""); //MenuFormFactory.MenuFrmTypeDict.ToList().ForEach(t => @@ -491,15 +491,18 @@ private void Device_OnDeviceStateChanged(IDevice device, EnumHelper.DeviceState currentState) { - for (int i = 1; i < ststripDevices.Items.Count; i++) + ststripDevices.BeginInvoke(new Action(() => { - if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id) + for (int i = 1; i < ststripDevices.Items.Count; i++) { - ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor(); - ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor(); - break; + if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id) + { + ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor(); + ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor(); + break; + } } - } + })); } #endregion diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.cs b/src/Bro.UI.Config/MenuForms/FrmConfig.cs index ef01a46..b58f66c 100644 --- a/src/Bro.UI.Config/MenuForms/FrmConfig.cs +++ b/src/Bro.UI.Config/MenuForms/FrmConfig.cs @@ -53,7 +53,7 @@ private void buttonCreateConfig_Click(object sender, EventArgs e) { - string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜","",0,0); + string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜", "", 0, 0); if (string.IsNullOrWhiteSpace(pCode)) { MessageBox.Show("璇疯緭鍏ヤ骇鍝佺紪鐮侊紒"); diff --git a/src/Bro.UI.Config/MenuForms/FrmOperation.cs b/src/Bro.UI.Config/MenuForms/FrmOperation.cs index 891d678..025c4fb 100644 --- a/src/Bro.UI.Config/MenuForms/FrmOperation.cs +++ b/src/Bro.UI.Config/MenuForms/FrmOperation.cs @@ -140,7 +140,7 @@ } bool isStart = true; - private void btnStart_Click(object sender, System.EventArgs e) + private async void btnStart_Click(object sender, System.EventArgs e) { if (Process == null) { @@ -157,11 +157,11 @@ //if (Process.ProcessState != EnumHelper.DeviceState.DSOpen) if (isStart) { - ProcessOperation(true); + await ProcessOperation(true); } else { - ProcessOperation(false); + await ProcessOperation(false); } isStart = !isStart; @@ -172,7 +172,8 @@ } finally { - this.BeginInvoke(new Action(() => btnStart.Enabled = true)); + //this.BeginInvoke(new Action(() => btnStart.Enabled = true)); + btnStart.Enabled = true; } //}); } @@ -255,11 +256,11 @@ // } //} - private void ProcessOperation(bool isStart) + private async Task ProcessOperation(bool isStart) { if (isStart) { - Process.Open(); + await Task.Run(() => Process.Open()); //this.BeginInvoke(new Action(() => //{ @@ -273,7 +274,7 @@ } else { - Process.Close(); + await Task.Run(() => Process.Close()); //this.BeginInvoke(new Action(() => //{ diff --git a/src/Bro.UI.Config/MenuForms/FrmOperation.resx b/src/Bro.UI.Config/MenuForms/FrmOperation.resx index 28530b7..b406f47 100644 --- a/src/Bro.UI.Config/MenuForms/FrmOperation.resx +++ b/src/Bro.UI.Config/MenuForms/FrmOperation.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm - CgAAAk1TRnQBSQFMAgEBAgEAAdgBAAHYAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CgAAAk1TRnQBSQFMAgEBAgEAAeABAAHgAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -182,7 +182,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD4 - CAAAAk1TRnQBSQFMAwEBAAHYAQAB2AEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + CAAAAk1TRnQBSQFMAwEBAAHgAQAB4AEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs index 2b8d8dd..0552bb9 100644 --- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs +++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs @@ -52,18 +52,18 @@ private void RadioButton_CheckedChanged(object sender, EventArgs e) { //鍔犺浇瀵瑰簲杩愬姩鐨� movingConfig - if (radioP2P.Checked) - { - movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal); - } - else if (radioJog.Checked) - { - movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog); - } - else if (radioGoHome.Checked) - { - movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri); - } + //if (radioP2P.Checked) + //{ + // movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal); + //} + //else if (radioJog.Checked) + //{ + // movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog); + //} + //else if (radioGoHome.Checked) + //{ + // movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri); + //} propGrid.SelectedObject = movingConfig; } -- Gitblit v1.8.0