Commit 6b1bd22e 张东亮

启用密码界面

1 个父辈 1ab5c55c
...@@ -26,7 +26,10 @@ namespace OnlineStore.Common ...@@ -26,7 +26,10 @@ namespace OnlineStore.Common
public static MyConfig<string> Server_CID = ""; public static MyConfig<string> Server_CID = "";
[MyConfigComment("服务器地址")] [MyConfigComment("服务器地址")]
public static MyConfig<string> Server_Addr = ""; public static MyConfig<string> Server_Addr = "";
[MyConfigComment("管理员密码")]
public static MyConfig<string> User_AdminPassword = "123456";
[MyConfigComment("启用管理员密码")]
public static MyConfig<bool> User_Enable = true;
[MyConfigComment("是否启用蜂鸣器")] [MyConfigComment("是否启用蜂鸣器")]
public static MyConfig<bool> Device_EnableBuzzer = true; public static MyConfig<bool> Device_EnableBuzzer = true;
[MyConfigComment("料仓类型")] [MyConfigComment("料仓类型")]
......
...@@ -22,7 +22,7 @@ namespace TheMachine ...@@ -22,7 +22,7 @@ namespace TheMachine
this.FlatStyle = FlatStyle.Flat; this.FlatStyle = FlatStyle.Flat;
this.BackColor = Color.White; this.BackColor = Color.White;
this.Tag = "not"; this.Tag = "not";
//RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
this.Click += CylinderButton_Click; this.Click += CylinderButton_Click;
timer = new Timer(); timer = new Timer();
timer.Interval = 1000; timer.Interval = 1000;
...@@ -44,7 +44,7 @@ namespace TheMachine ...@@ -44,7 +44,7 @@ namespace TheMachine
} }
private void RobotManage_LoadFinishEvent(bool state, string msg) private void RobotManage_LoadFinishEvent(bool state, string msg)
{ {
if (state) // if (state)
{ {
DataUpdate(); DataUpdate();
//this.Invoke((EventHandler)delegate { DataUpdate(); }); //this.Invoke((EventHandler)delegate { DataUpdate(); });
...@@ -89,7 +89,7 @@ namespace TheMachine ...@@ -89,7 +89,7 @@ namespace TheMachine
{ {
if (DeviceConfig.AllDOEleclist.ContainsKey(io_high)) if (DeviceConfig.AllDOEleclist.ContainsKey(io_high))
configio_high = DeviceConfig.AllDOEleclist[io_high]; configio_high = DeviceConfig.AllDOEleclist[io_high];
else else if (DeviceConfig.AllDOlist.ContainsKey(io_high))
configio_high = DeviceConfig.AllDOlist[io_high]; configio_high = DeviceConfig.AllDOlist[io_high];
} }
...@@ -111,6 +111,7 @@ namespace TheMachine ...@@ -111,6 +111,7 @@ namespace TheMachine
} }
void StateUpdate() void StateUpdate()
{ {
if (configio_high == null) return;
io_state = IOManager.GetDOValue(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr()); io_state = IOManager.GetDOValue(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr());
if (configio_low != null) if (configio_low != null)
{ {
......
...@@ -52,6 +52,7 @@ namespace TheMachine ...@@ -52,6 +52,7 @@ namespace TheMachine
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button();
this.cylinderButton1 = new TheMachine.CylinderButton();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
...@@ -142,6 +143,7 @@ namespace TheMachine ...@@ -142,6 +143,7 @@ namespace TheMachine
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.cylinderButton1);
this.tabPage1.Controls.Add(this.pictureBox2); this.tabPage1.Controls.Add(this.pictureBox2);
this.tabPage1.Controls.Add(this.pictureBox1); this.tabPage1.Controls.Add(this.pictureBox1);
this.tabPage1.Controls.Add(this.btn_opendoor); this.tabPage1.Controls.Add(this.btn_opendoor);
...@@ -187,7 +189,7 @@ namespace TheMachine ...@@ -187,7 +189,7 @@ namespace TheMachine
// btn_opendoor // btn_opendoor
// //
this.btn_opendoor.BackColor = System.Drawing.Color.White; this.btn_opendoor.BackColor = System.Drawing.Color.White;
this.btn_opendoor.Location = new System.Drawing.Point(657, 236); this.btn_opendoor.Location = new System.Drawing.Point(657, 265);
this.btn_opendoor.Name = "btn_opendoor"; this.btn_opendoor.Name = "btn_opendoor";
this.btn_opendoor.Size = new System.Drawing.Size(201, 40); this.btn_opendoor.Size = new System.Drawing.Size(201, 40);
this.btn_opendoor.TabIndex = 6; this.btn_opendoor.TabIndex = 6;
...@@ -313,6 +315,19 @@ namespace TheMachine ...@@ -313,6 +315,19 @@ namespace TheMachine
this.btn_run.UseVisualStyleBackColor = true; this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click); this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
// //
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.IO_HIGH = "Device_Led";
this.cylinderButton1.IO_LOW = null;
this.cylinderButton1.Location = new System.Drawing.Point(657, 207);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(201, 40);
this.cylinderButton1.TabIndex = 272;
this.cylinderButton1.Tag = "not";
this.cylinderButton1.Text = "Device_Led";
this.cylinderButton1.UseVisualStyleBackColor = false;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
...@@ -368,6 +383,7 @@ namespace TheMachine ...@@ -368,6 +383,7 @@ namespace TheMachine
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_IgnoreX09; private System.Windows.Forms.Button btn_IgnoreX09;
private System.Windows.Forms.Button btn_opendoor; private System.Windows.Forms.Button btn_opendoor;
private CylinderButton cylinderButton1;
} }
} }
...@@ -201,6 +201,8 @@ namespace TheMachine ...@@ -201,6 +201,8 @@ namespace TheMachine
private void 启用调试模式ToolStripMenuItem_Click(object sender, EventArgs e) private void 启用调试模式ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (!RobotManage.IsConfigMode && !FrmPassCheck.CheckPassword())
return;
RobotManage.IsConfigMode = RobotManage.IsConfigMode ? false : true; RobotManage.IsConfigMode = RobotManage.IsConfigMode ? false : true;
(sender as ToolStripMenuItem).Text = !RobotManage.IsConfigMode ? "启用配置模式" : "停用配置模式"; (sender as ToolStripMenuItem).Text = !RobotManage.IsConfigMode ? "启用配置模式" : "停用配置模式";
......
...@@ -86,5 +86,10 @@ namespace TheMachine ...@@ -86,5 +86,10 @@ namespace TheMachine
{ {
RobotManage.mainMachine.RightInOut.Line.LineRun("n", true, 999); RobotManage.mainMachine.RightInOut.Line.LineRun("n", true, 999);
} }
private void cylinderButton1_Click(object sender, EventArgs e)
{
}
} }
} }
...@@ -123,6 +123,12 @@ ...@@ -123,6 +123,12 @@
<Compile Include="SettingControl.Designer.cs"> <Compile Include="SettingControl.Designer.cs">
<DependentUpon>SettingControl.cs</DependentUpon> <DependentUpon>SettingControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UC\FrmPassCheck.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UC\FrmPassCheck.designer.cs">
<DependentUpon>FrmPassCheck.cs</DependentUpon>
</Compile>
<Compile Include="UC\StorePosControl.cs"> <Compile Include="UC\StorePosControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -188,6 +194,9 @@ ...@@ -188,6 +194,9 @@
<EmbeddedResource Include="SettingControl.resx"> <EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon> <DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UC\FrmPassCheck.resx">
<DependentUpon>FrmPassCheck.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\StorePosControl.resx"> <EmbeddedResource Include="UC\StorePosControl.resx">
<DependentUpon>StorePosControl.cs</DependentUpon> <DependentUpon>StorePosControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
using OnlineStore;
using OnlineStore.Common;
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 TheMachine
{
public partial class FrmPassCheck : Form
{
public FrmPassCheck()
{
InitializeComponent();
}
public static bool CheckPassword() {
if (!Setting_Init.User_Enable)
return true;
FrmPassCheck frmPassCheck = new FrmPassCheck();
var result = frmPassCheck.ShowDialog();
return (result == DialogResult.OK);
}
private void btn_cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
this.Close();
}
private void btn_ok_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() == Setting_Init.User_AdminPassword.Val.Trim())
{
DialogResult = DialogResult.OK;
this.Close();
}
else
MessageBox.Show(crc.GetString("Res0057","密码不正确请重新输入!"));
}
}
}
\ No newline at end of file \ No newline at end of file

namespace TheMachine
{
partial class FrmPassCheck
{
/// <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.textBox1 = new System.Windows.Forms.TextBox();
this.btn_ok = new System.Windows.Forms.Button();
this.btn_cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.textBox1.Location = new System.Drawing.Point(114, 88);
this.textBox1.Name = "textBox1";
this.textBox1.PasswordChar = '*';
this.textBox1.Size = new System.Drawing.Size(318, 29);
this.textBox1.TabIndex = 0;
//
// btn_ok
//
this.btn_ok.Location = new System.Drawing.Point(352, 189);
this.btn_ok.Name = "btn_ok";
this.btn_ok.Size = new System.Drawing.Size(129, 49);
this.btn_ok.TabIndex = 1;
this.btn_ok.Text = "确定";
this.btn_ok.UseVisualStyleBackColor = true;
this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
//
// btn_cancel
//
this.btn_cancel.Location = new System.Drawing.Point(40, 189);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(129, 49);
this.btn_cancel.TabIndex = 1;
this.btn_cancel.Text = "取消";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// FrmPassCheck
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(548, 275);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_ok);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmPassCheck";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "请输入密码";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button btn_ok;
private System.Windows.Forms.Button btn_cancel;
}
}
\ No newline at end of file \ No newline at end of file
<?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>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!