领胜LDS 键盘AOI检测项目
xcd
2020-07-08 9b5a866d16ca2b7a68d3af5bac8ea29c4626902f
添加快捷操作界面
1个文件已添加
8个文件已修改
337 ■■■■■ 已修改文件
src/Bro.M071.Process/Bro.M071.Process.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_MainForm.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_ShortcutFrm.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_ShortcutFrm.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/AdvancedPwdFrm.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/AdvancedPwdFrm.designer.cs 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MainFrm.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/UI/DockContent/MenuFrmBase.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/Bro.M071.Process.csproj
@@ -152,6 +152,9 @@
    <EmbeddedResource Include="UI\M071_MainForm.resx">
      <DependentUpon>M071_MainForm.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="UI\M071_ShortcutFrm.resx">
      <DependentUpon>M071_ShortcutFrm.cs</DependentUpon>
    </EmbeddedResource>
    <None Include="App.config">
      <SubType>Designer</SubType>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -33,10 +33,12 @@
            tscEditLocation.Visible = tsmiShowEditor.Checked = false;
            this.Load += (s, e) =>
              {
                  cvImage.SetScreenSize();
              };
            this.Load += async (s, e) =>
               {
                   await Task.Delay(300);
                   cvImage.SetScreenSize();
               };
        }
        public override void OnProcessUpdated()
@@ -52,7 +54,7 @@
            try
            {
                Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath);
                cvImage.LoadImage(image);
                cvImage.LoadImage(image);
                cvImage.SetScreenSize();
            }
            catch (Exception ex)
src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs
@@ -28,12 +28,103 @@
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
            this.chkBlockSaftyDoor = new System.Windows.Forms.CheckBox();
            this.chkBlockSafetyBeam = new System.Windows.Forms.CheckBox();
            this.chkBlockBeep = new System.Windows.Forms.CheckBox();
            this.chkManualInputForbidden = new System.Windows.Forms.CheckBox();
            this.btnLightSwitch = new System.Windows.Forms.Button();
            this.flowLayoutPanel1.SuspendLayout();
            this.SuspendLayout();
            //
            // flowLayoutPanel1
            //
            this.flowLayoutPanel1.Controls.Add(this.chkBlockSaftyDoor);
            this.flowLayoutPanel1.Controls.Add(this.chkBlockSafetyBeam);
            this.flowLayoutPanel1.Controls.Add(this.chkBlockBeep);
            this.flowLayoutPanel1.Controls.Add(this.chkManualInputForbidden);
            this.flowLayoutPanel1.Controls.Add(this.btnLightSwitch);
            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Size = new System.Drawing.Size(800, 450);
            this.flowLayoutPanel1.TabIndex = 0;
            //
            // chkBlockSaftyDoor
            //
            this.chkBlockSaftyDoor.AutoSize = true;
            this.chkBlockSaftyDoor.Location = new System.Drawing.Point(3, 3);
            this.chkBlockSaftyDoor.Name = "chkBlockSaftyDoor";
            this.chkBlockSaftyDoor.Size = new System.Drawing.Size(86, 17);
            this.chkBlockSaftyDoor.TabIndex = 0;
            this.chkBlockSaftyDoor.Text = "屏蔽安全门";
            this.chkBlockSaftyDoor.UseVisualStyleBackColor = true;
            this.chkBlockSaftyDoor.CheckedChanged += new System.EventHandler(this.chkBlockSaftyDoor_CheckedChanged);
            //
            // chkBlockSafetyBeam
            //
            this.chkBlockSafetyBeam.AutoSize = true;
            this.chkBlockSafetyBeam.Location = new System.Drawing.Point(95, 3);
            this.chkBlockSafetyBeam.Name = "chkBlockSafetyBeam";
            this.chkBlockSafetyBeam.Size = new System.Drawing.Size(98, 17);
            this.chkBlockSafetyBeam.TabIndex = 1;
            this.chkBlockSafetyBeam.Text = "屏蔽安全光线";
            this.chkBlockSafetyBeam.UseVisualStyleBackColor = true;
            this.chkBlockSafetyBeam.CheckedChanged += new System.EventHandler(this.chkBlockSafetyBeam_CheckedChanged);
            //
            // chkBlockBeep
            //
            this.chkBlockBeep.AutoSize = true;
            this.chkBlockBeep.Location = new System.Drawing.Point(199, 3);
            this.chkBlockBeep.Name = "chkBlockBeep";
            this.chkBlockBeep.Size = new System.Drawing.Size(86, 17);
            this.chkBlockBeep.TabIndex = 2;
            this.chkBlockBeep.Text = "屏蔽蜂鸣器";
            this.chkBlockBeep.UseVisualStyleBackColor = true;
            this.chkBlockBeep.CheckedChanged += new System.EventHandler(this.chkBlockBeep_CheckedChanged);
            //
            // chkManualInputForbidden
            //
            this.chkManualInputForbidden.AutoSize = true;
            this.chkManualInputForbidden.Location = new System.Drawing.Point(291, 3);
            this.chkManualInputForbidden.Name = "chkManualInputForbidden";
            this.chkManualInputForbidden.Size = new System.Drawing.Size(122, 17);
            this.chkManualInputForbidden.TabIndex = 4;
            this.chkManualInputForbidden.Text = "禁止手动输入条码";
            this.chkManualInputForbidden.UseVisualStyleBackColor = true;
            this.chkManualInputForbidden.CheckedChanged += new System.EventHandler(this.chkManualInputForbidden_CheckedChanged);
            //
            // btnLightSwitch
            //
            this.btnLightSwitch.Location = new System.Drawing.Point(419, 3);
            this.btnLightSwitch.Name = "btnLightSwitch";
            this.btnLightSwitch.Size = new System.Drawing.Size(75, 36);
            this.btnLightSwitch.TabIndex = 5;
            this.btnLightSwitch.Text = "日光灯开关";
            this.btnLightSwitch.UseVisualStyleBackColor = true;
            this.btnLightSwitch.Click += new System.EventHandler(this.btnLightSwitch_Click);
            //
            // M071_ShortcutFrm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 450);
            this.Controls.Add(this.flowLayoutPanel1);
            this.Name = "M071_ShortcutFrm";
            this.Text = "M071_ShortcutFrm";
            this.flowLayoutPanel1.ResumeLayout(false);
            this.flowLayoutPanel1.PerformLayout();
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
        private System.Windows.Forms.CheckBox chkBlockSaftyDoor;
        private System.Windows.Forms.CheckBox chkBlockSafetyBeam;
        private System.Windows.Forms.CheckBox chkBlockBeep;
        private System.Windows.Forms.CheckBox chkManualInputForbidden;
        private System.Windows.Forms.Button btnLightSwitch;
    }
}
src/Bro.M071.Process/UI/M071_ShortcutFrm.cs
@@ -6,6 +6,7 @@
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -17,6 +18,81 @@
        public M071_ShortcutFrm()
        {
            InitializeComponent();
            this.Load += (s, e) =>
              {
                  loadHandle.Set();
              };
        }
        ManualResetEventSlim loadHandle = new ManualResetEventSlim(false);
        M071Config Config => Process?.IConfig as M071Config;
        M071Process Process_M071 => Process as M071Process;
        protected override bool IsLogin
        {
            get => base.IsLogin;
            set
            {
                base.IsLogin = value;
                Task.Run(() =>
                {
                    if (loadHandle.Wait(1000))
                    {
                        this.Invoke(new Action(() =>
                        {
                            chkBlockSafetyBeam.Enabled = chkBlockSaftyDoor.Enabled = IsLogin;
                        }));
                    }
                });
            }
        }
        public override void OnProcessUpdated()
        {
            base.OnProcessUpdated();
            Task.Run(() =>
            {
                if (loadHandle.Wait(1000))
                {
                    this.Invoke(new Action(() =>
                    {
                        chkBlockBeep.Checked = Config.IsBeepBlocked;
                        chkBlockSafetyBeam.Checked = Config.IsSafetyBeamBlocked;
                        chkBlockSaftyDoor.Checked = Config.IsSafetyDoorBlocked;
                        chkManualInputForbidden.Checked = Config.IsBarcodeManulInputBlocked;
                    }));
                }
            });
        }
        private void chkBlockSaftyDoor_CheckedChanged(object sender, EventArgs e)
        {
            Config.IsSafetyDoorBlocked = chkBlockSaftyDoor.Checked;
        }
        private void chkBlockSafetyBeam_CheckedChanged(object sender, EventArgs e)
        {
            Config.IsSafetyBeamBlocked = chkBlockSafetyBeam.Checked;
        }
        private void chkBlockBeep_CheckedChanged(object sender, EventArgs e)
        {
            Config.IsBeepBlocked = chkBlockBeep.Checked;
        }
        private void chkManualInputForbidden_CheckedChanged(object sender, EventArgs e)
        {
            Config.IsBarcodeManulInputBlocked = chkManualInputForbidden.Checked;
        }
        bool isLightOn = false;
        private void btnLightSwitch_Click(object sender, EventArgs e)
        {
            isLightOn = !isLightOn;
            Process_M071.SwitchLight(isLightOn);
        }
    }
}
src/Bro.M071.Process/UI/M071_ShortcutFrm.resx
New file
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
src/Bro.UI.Config/AdvancedPwdFrm.cs
@@ -76,5 +76,11 @@
                CheckInputPassword();
            }
        }
        private void btnExitLogin_Click(object sender, EventArgs e)
        {
            OnLoginOK?.Invoke(false);
            this.DialogResult = DialogResult.Abort;
        }
    }
}
src/Bro.UI.Config/AdvancedPwdFrm.designer.cs
@@ -32,11 +32,12 @@
            this.label1 = new System.Windows.Forms.Label();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnOK = new System.Windows.Forms.Button();
            this.btnExitLogin = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // txtPwd
            // 
            this.txtPwd.Font = new System.Drawing.Font("SimSun", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtPwd.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtPwd.Location = new System.Drawing.Point(126, 28);
            this.txtPwd.Name = "txtPwd";
            this.txtPwd.PasswordChar = '*';
@@ -47,7 +48,7 @@
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("SimSun", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(32, 32);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(52, 14);
@@ -57,7 +58,7 @@
            // btnCancel
            // 
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnCancel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnCancel.Location = new System.Drawing.Point(208, 63);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(75, 23);
@@ -68,7 +69,7 @@
            // 
            // btnOK
            // 
            this.btnOK.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnOK.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnOK.Location = new System.Drawing.Point(289, 63);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size(75, 23);
@@ -76,6 +77,18 @@
            this.btnOK.Text = "OK";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += new System.EventHandler(this.button2_Click);
            //
            // btnExitLogin
            //
            this.btnExitLogin.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnExitLogin.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnExitLogin.Location = new System.Drawing.Point(12, 63);
            this.btnExitLogin.Name = "btnExitLogin";
            this.btnExitLogin.Size = new System.Drawing.Size(75, 23);
            this.btnExitLogin.TabIndex = 2;
            this.btnExitLogin.Text = "退出登录";
            this.btnExitLogin.UseVisualStyleBackColor = true;
            this.btnExitLogin.Click += new System.EventHandler(this.btnExitLogin_Click);
            // 
            // AdvancedPwdFrm
            // 
@@ -85,6 +98,7 @@
            this.ClientSize = new System.Drawing.Size(388, 98);
            this.ControlBox = false;
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.btnExitLogin);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtPwd);
@@ -103,5 +117,6 @@
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnCancel;
        private System.Windows.Forms.Button btnOK;
        private System.Windows.Forms.Button btnExitLogin;
    }
}
src/Bro.UI.Config/MainFrm.cs
@@ -317,7 +317,7 @@
        private void OnLoginOK(bool isLogin)
        {
            IsLogin = true;
            IsLogin = isLogin;
        }
        #endregion
src/Bro.UI.Model.Winform/UI/DockContent/MenuFrmBase.cs
@@ -81,7 +81,7 @@
        #endregion
        #region Login
        protected bool IsLogin { get; set; }
        protected virtual bool IsLogin { get; set; }
        public virtual void SetLoginStatus(bool isLogin)
        {