Commit 14b26d85 authored by surukun's avatar surukun

konkedemo

parents
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
public class AutoTestService
{
private ConcurrentDictionary<int, UserControlmodular> ModularDictionary = new ConcurrentDictionary<int, UserControlmodular>();//双向链表
public AutoTestService() { }
public AutoTestService(ConcurrentDictionary<int, UserControlmodular> keyValues)
{
this.ModularDictionary = keyValues;
ThreadRun = new Thread[keyValues.Count];
}
private bool[] UpdateError;
private Thread[] ThreadRun;
protected bool isAllTestThreadsFinished()
{
for (int i = 0; i < ThreadRun.Length; i++)
{
if (ThreadRun[i] != null
&& (ThreadRun[i].ThreadState != System.Threading.ThreadState.Aborted
&& ThreadRun[i].ThreadState != System.Threading.ThreadState.Stopped
&& ThreadRun[i].ThreadState != System.Threading.ThreadState.Unstarted))
{
}
else
{
if (!UpdateError[i])
{
ModularDictionary[i + 1].fnUpdate();
UpdateError[i] = true;
}
}
}
foreach (Thread thread in ThreadRun)
if (thread != null
&& (thread.ThreadState != System.Threading.ThreadState.Aborted
&& thread.ThreadState != System.Threading.ThreadState.Stopped
&& thread.ThreadState != System.Threading.ThreadState.Unstarted))
return false;
return true;
}
public void Run(DeviceInfo deviceinfo)
{
try
{
UpdateError = new bool[ModularDictionary.Count];
for (int i = 0; i < ModularDictionary.Count; i++)
{
ModularDictionary[i + 1].Init();
object obj = new object();
ThreadRun[i] = new Thread(new ParameterizedThreadStart(ModularDictionary[i + 1].Run));
ThreadRun[i].Start(obj);
}
while (!isAllTestThreadsFinished())
{
System.Threading.Thread.Sleep(100);
Application.DoEvents();
}
for (int i = 0; i < ModularDictionary.Count; i++)
{
if (!UpdateError[i])
ModularDictionary[i + 1].fnUpdate();
ModularDictionary[i + 1].Finished();
}
}
catch (Exception exc) { }
}
public void Stop()
{
UIDemoProcess autoTest = new UIDemoProcess();
autoTest.Stop();
}
public BaseConfig GetConfig()
{
UIDemoProcess autoTest = new UIDemoProcess();
return autoTest.GetConfig();
}
public void SetConfig(BaseConfig baseconfig)
{
UIDemoProcess autoTest = new UIDemoProcess();
autoTest.SetConfig(baseconfig);
}
}
}
namespace KonkeDemo
{
partial class UCNavigationMenuExt
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// UCNavigationMenuExt
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "UCNavigationMenuExt";
this.Leave += new System.EventHandler(this.UCNavigationMenuExt_Leave);
this.ResumeLayout(false);
}
#endregion
}
}
This diff is collapsed.
namespace KonkeDemo
{
partial class UCPanelTitle
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.lblTitle = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.IndianRed;
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.ForeColor = System.Drawing.Color.Black;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(432, 34);
this.lblTitle.TabIndex = 0;
this.lblTitle.Text = "错误信息";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// richTextBox1
//
this.richTextBox1.ForeColor = System.Drawing.Color.Red;
this.richTextBox1.Location = new System.Drawing.Point(0, 34);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(432, 220);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(169, 260);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 26);
this.button1.TabIndex = 2;
this.button1.Text = "复制";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UCPanelTitle
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = 10;
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.lblTitle);
this.FillColor = System.Drawing.Color.White;
this.IsRadius = true;
this.IsShowRect = true;
this.Name = "UCPanelTitle";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(160)))), ((int)(((byte)(133)))));
this.Size = new System.Drawing.Size(432, 298);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HZH_Controls.Controls;
namespace KonkeDemo
{
public partial class UCPanelTitle : UCControlBase
{
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return this.RectColor; }
set
{
this.RectColor = value;
this.lblTitle.BackColor = value;
}
}
[Description("面板标题"), Category("自定义")]
public string Title
{
get { return lblTitle.Text; }
set { lblTitle.Text = value; }
}
public string Msg
{
get { return richTextBox1.Text.Trim(); }
set { richTextBox1.AppendText(value + "\r\n"); }
}
public UCPanelTitle()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Clipboard.SetText(richTextBox1.Text);
}
public void Clear()
{
if (richTextBox1.IsHandleCreated)
{
richTextBox1.Invoke(new EventHandler(delegate
{
richTextBox1.Clear();
richTextBox1.Refresh();
}));
}
else
{
richTextBox1.Clear();
richTextBox1.Refresh();
}
}
}
}
namespace KonkeDemo
{
partial class UCPanelTitleInfo
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.lblTitle = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.SpringGreen;
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.ForeColor = System.Drawing.Color.Black;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(432, 34);
this.lblTitle.TabIndex = 0;
this.lblTitle.Text = "基本信息";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(0, 34);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(429, 232);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(171, 272);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 26);
this.button1.TabIndex = 3;
this.button1.Text = "复制";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UCPanelTitleInfo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = 10;
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.lblTitle);
this.FillColor = System.Drawing.Color.White;
this.IsRadius = true;
this.IsShowRect = true;
this.Name = "UCPanelTitleInfo";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(160)))), ((int)(((byte)(133)))));
this.Size = new System.Drawing.Size(432, 301);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HZH_Controls.Controls;
namespace KonkeDemo
{
public partial class UCPanelTitleInfo : UCControlBase
{
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return this.RectColor; }
set
{
this.RectColor = value;
this.lblTitle.BackColor = value;
}
}
[Description("面板标题"), Category("自定义")]
public string Title
{
get { return lblTitle.Text; }
set { lblTitle.Text = value; }
}
public string Msg
{
get { return richTextBox1.Text.Trim(); }
set { richTextBox1.AppendText(value + "\r\n"); }
}
public UCPanelTitleInfo()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Clipboard.SetText(richTextBox1.Text);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HZH_Controls;
using System.Drawing.Drawing2D;
namespace KonkeDemo
{
public class UCProcessLine : Control
{
[Description("值变更事件"), Category("自定义")]
public event EventHandler ValueChanged;
int m_value = 0;
[Description("当前属性"), Category("自定义")]
public int Value
{
set
{
if (value > m_maxValue)
m_value = m_maxValue;
else if (value < 0)
m_value = 0;
else
m_value = value;
if (ValueChanged != null)
ValueChanged(this, null);
Refresh();
}
get
{
return m_value;
}
}
private int m_maxValue = 100;
[Description("最大值"), Category("自定义")]
public int MaxValue
{
get { return m_maxValue; }
set
{
if (value < m_value)
m_maxValue = m_value;
else
m_maxValue = value;
Refresh();
}
}
Color m_valueColor = Color.FromArgb(73, 119, 232);
[Description("值进度条颜色"), Category("自定义")]
public Color ValueColor
{
get { return m_valueColor; }
set
{
m_valueColor = value;
Refresh();
}
}
private Color m_valueBGColor = Color.White;
[Description("值背景色"), Category("自定义")]
public Color ValueBGColor
{
get { return m_valueBGColor; }
set
{
m_valueBGColor = value;
Refresh();
}
}
private Color m_borderColor = Color.FromArgb(192, 192, 192);
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return m_borderColor; }
set
{
m_borderColor = value;
Refresh();
}
}
[Description("值字体"), Category("自定义")]
public override Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
Refresh();
}
}
[Description("值字体颜色"), Category("自定义")]
public override System.Drawing.Color ForeColor
{
get
{
return base.ForeColor;
}
set
{
base.ForeColor = value;
Refresh();
}
}
private ValueTextType m_valueTextType = ValueTextType.Percent;
[Description("值显示样式"), Category("自定义")]
public ValueTextType ValueTextType
{
get { return m_valueTextType; }
set
{
m_valueTextType = value;
Refresh();
}
}
public UCProcessLine()
{
Size = new Size(200, 15);
ForeColor = Color.FromArgb(255, 77, 59);
Font = new Font("Arial Unicode MS", 10);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
Console.WriteLine(DateTime.Now);
base.OnPaint(e);
Graphics g = e.Graphics;
g.SetGDIHigh();
Brush sb = new SolidBrush(m_valueBGColor);
g.FillRectangle(sb, new Rectangle(base.ClientRectangle.X, base.ClientRectangle.Y, base.ClientRectangle.Width - 3, base.ClientRectangle.Height - 2));
GraphicsPath path1 = ControlHelper.CreateRoundedRectanglePath(new Rectangle(base.ClientRectangle.X, base.ClientRectangle.Y + 1, base.ClientRectangle.Width - 3, base.ClientRectangle.Height - 4), 3);
g.DrawPath(new Pen(m_borderColor, 1), path1);
LinearGradientBrush lgb = new LinearGradientBrush(new Point(0, 0), new Point(0, base.ClientRectangle.Height - 3), m_valueColor, Color.FromArgb(200, m_valueColor.R, m_valueColor.G, m_valueColor.B));
g.FillPath(lgb, ControlHelper.CreateRoundedRectanglePath(new Rectangle(0, (base.ClientRectangle.Height - (base.ClientRectangle.Height - 3)) / 2, (base.ClientRectangle.Width - 3) * Value / m_maxValue, base.ClientRectangle.Height - 4), 3));
string strValue = string.Empty;
if (m_valueTextType == ValueTextType.Percent)//m_valueTextType == HZH_Controls.Controls.ValueTextType.Percent
strValue = ((float)Value / (float)m_maxValue).ToString("0%");
else if (m_valueTextType == ValueTextType.Absolute)//m_valueTextType == HZH_Controls.Controls.ValueTextType.Absolute
strValue = Value + "/" + m_maxValue;
if (!string.IsNullOrEmpty(strValue))
{
System.Drawing.SizeF sizeF = g.MeasureString(strValue, Font);
g.DrawString(strValue, Font, new SolidBrush(ForeColor), new PointF((this.Width - sizeF.Width) / 2, (this.Height - sizeF.Height) / 2 + 1));
}
}
public static implicit operator UCProcessLine(HZH_Controls.Controls.UCProcessLine v)
{
throw new NotImplementedException();
}
}
public enum ValueTextType
{
None,
/// <summary>
/// 百分比
/// </summary>
Percent,
/// <summary>
/// 数值
/// </summary>
Absolute
}
}
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
public partial class UserControlmodular : UserControl
{
private UCPanelTitleInfo textinfo = new UCPanelTitleInfo();
private UCPanelTitle texttitle = new UCPanelTitle();
public UserControlmodular()
{
InitializeComponent();
textinfo.Msg = "deviceid: 010203";
textinfo.Msg = "RSSI: -90";
textinfo.Msg = "SoftVersion: 1.0";
textinfo.Msg = "HardVersion: 2.0";
textinfo.Msg = "Installcode: 290001";
textinfo.Msg = "MAC: 123456789";
ucNavigationMenuExt1.Items[0].ShowControl = textinfo;
//ucNavigationMenuExt1.Items[1].TipText = "2";
//ucNavigationMenuExt1.Items[1].ShowTip = true;
//texttitle.Msg = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss") + ": " + "入网失败";
//text.Text = "读取信号强度失败";
ucNavigationMenuExt1.Items[1].ShowControl = texttitle;
}
public string TipText
{
set
{
ucNavigationMenuExt1.Invoke(new EventHandler(delegate
{
ucNavigationMenuExt1.Items[1].ShowTip = true;
ucNavigationMenuExt1.Items[1].TipText = value;
this.Refresh();
}));
}
}
public string Infomsg
{
set
{
textinfo.Msg = value;
}
}
public string Errormsg
{
set
{
texttitle.Msg = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss") + ": " + value.ToString();
this.Refresh();
}
}
public string SN
{
get
{
return textEdit1.Text.Trim();
}
set
{
textEdit1.Text = value;
}
}
public int Process
{
set
{
ucProcessLine1.Value = value;
}
}
public int iconclusion
{
set
{
if (value == 1)
{
label2.Text = "测试成功";
panel3.BackColor = Color.SpringGreen;
}
else if (value == 0)
{
label2.Text = "测试失败";
panel3.BackColor = Color.Red;
}
else if (value == 2)
{
label2.Text = "准备";
panel3.BackColor = Color.Gold;
}
}
}
public int position
{
set
{
label3.Text = value.ToString();
}
}
public int ControlWidth
{
get
{
return this.Width;
}
}
public string status
{
set
{
label2.Text = value.ToString();
}
}
private int errorcnt;
public int ErrorCnt
{
get { return errorcnt; }
set { errorcnt = value; }
}
private List<string> TErrorlog = new List<string>();
public virtual void ViewLog(Helper.CustomMessage customMessage, string message)
{
try
{
switch (customMessage)
{
case Helper.CustomMessage.ViewLog:
label2.Invoke(new EventHandler(delegate
{
label2.Text = message;
}));
break;
case Helper.CustomMessage.Alarm:
//texttitle = new UCPanelTitle();
ErrorCnt++;
TErrorlog.Add(message);
//TipText = ErrorCnt.ToString();
//Errormsg = message;
break;
case Helper.CustomMessage.QuerySN:
break;
case Helper.CustomMessage.Stop:
break;
case Helper.CustomMessage.Progress:
int process = 0;
if (int.TryParse(message, out process))
{
ucProcessLine1.Invoke(new EventHandler(delegate
{
ucProcessLine1.Value = process;
}));
}
break;
case Helper.CustomMessage.Result:
if (message.Equals("0"))
{
panel3.Invoke(new EventHandler(delegate
{
panel3.BackColor = Color.Red;
panel3.Refresh();
}));
}
else if (message.Equals("1"))
{
panel3.Invoke(new EventHandler(delegate
{
panel3.BackColor = Color.SpringGreen;
panel3.Refresh();
}));
}
break;
}
}
catch(Exception exc) { }
}
public void fnUpdate()
{
if (ErrorCnt > 0)
{
TipText = ErrorCnt.ToString();
for (int i = 0; i < TErrorlog.Count; i++)
{
Errormsg = TErrorlog[i];
}
}
}
public void Finished()
{
textEdit1.Invoke(new EventHandler(delegate
{
textEdit1.Enabled = true;
}));
}
public void Init()
{
ErrorCnt = 0;
TErrorlog = new List<string>();
ucNavigationMenuExt1.Invoke(new EventHandler(delegate
{
ucNavigationMenuExt1.Items[1].ShowTip = false;
this.Refresh();
}));
this.BackColor = System.Drawing.Color.Aqua;
Process = 0;
iconclusion = 2;
texttitle.Clear();
textEdit1.Invoke(new EventHandler(delegate
{
textEdit1.Enabled = false;
}));
}
public void Run(object obj)
{
bTest = true;
topSeconds = 0;
UIDemoProcess autoTest = new UIDemoProcess();
autoTest.SendMessage += ViewLog;
autoTest.Run(null);
autoTest.SendMessage -= ViewLog;
bTest = false;
topSeconds = 0;
}
private bool bTest = false;
private int topSeconds = 0;
private void timer1_Tick(object sender, EventArgs e)
{
try
{
if (bTest)
{
topSeconds++;
label1.Invoke(new EventHandler(delegate
{
label1.Text = string.Format("耗时: {0} S", topSeconds);
}));
}
}
catch { }
}
}
}
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
public class ControlChangesWithWindows
{
private float TempFormX;//当前窗体的宽度
private float TempFormY;//当前窗体的高度
// 将控件的宽,高,左边距,顶边距和字体大小暂存到tag属性中
// <param name="cons">递归控件中的控件</param>
//传入参数当前窗口
private void setTag(Control cons)
{
foreach (Control con in cons.Controls)
{
con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top + ":" + con.Font.Size;
if (con.Controls.Count > 0)
{
setTag(con);
}
}
}
//根据窗体大小调整控件大小
//传入参数,窗体宽度缩放比例,窗体高度缩放比例,当前窗口
private void setControls(float newx, float newy, Control cons)
{
//遍历窗体中的控件,重新设置控件的值
foreach (Control con in cons.Controls)
{
if (con != null)
{
string[] mytag = con.Tag?.ToString().Split(new char[] { ':' });//获取控件的Tag属性值,并分割后存储字符串数组
if (mytag != null && mytag.Length >= 5)
{
float a = System.Convert.ToSingle(mytag[0]) * newx;//根据窗体缩放比例确定控件的值,宽度
con.Width = (int)a;//宽度
a = System.Convert.ToSingle(mytag[1]) * newy;//高度
con.Height = (int)(a);
a = System.Convert.ToSingle(mytag[2]) * newx;//左边距离
con.Left = (int)(a);
a = System.Convert.ToSingle(mytag[3]) * newy;//上边缘距离
con.Top = (int)(a);
Single currentSize = System.Convert.ToSingle(mytag[4]) * newy;//字体大小
con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
if (con.Controls.Count > 0)
{
setControls(newx, newy, con);
}
}
}
}
}
//传入参数:当前窗口
//用于窗口load事件调用
public void MethodForLoad(Control cons)
{
TempFormX = cons.Width;//获取窗体的宽度
TempFormY = cons.Height;//获取窗体的高度
setTag(cons);
}
/// <summary>
/// 窗口load事件调用,设置控件初始大小
/// </summary>
/// <param name="cons">当前窗口</param>
/// <param name="ctlSizeReferent">大小变化的参考控件</param>
public void MethodForLoad(Control cons, Control ctlSizeReferent)
{
TempFormX = ctlSizeReferent.Width;//获取窗体的宽度
TempFormY = ctlSizeReferent.Height;//获取窗体的高度
setTag(cons);
}
//引用SendMessage函数
[DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);
//传入参数:当前窗口
//用于窗口Resize事件调用
public void MethodForResize(Control cons)
{
float newx = (cons.Width) / TempFormX; //窗体宽度缩放比例
float newy = (cons.Height) / TempFormY;//窗体高度缩放比例
SendMessage(cons.Handle, 0xB, 0, IntPtr.Zero); //解决控件较多时,改变大小闪一下问题
setControls(newx, newy, cons);
SendMessage(cons.Handle, 0XB, 1, IntPtr.Zero);
cons.Invalidate(true);
}
/// <summary>
/// 窗口Resize事件调用
/// </summary>
/// <param name="cons">当前窗口</param>
/// <param name="ctlSizeReferent">大小变化的参考控件</param>
public void MethodForResize(Control cons, Control ctlSizeReferent)
{
float newx = (ctlSizeReferent.Width) / TempFormX; //窗体宽度缩放比例
float newy = (ctlSizeReferent.Height) / TempFormY;//窗体高度缩放比例
SendMessage(cons.Handle, 0xB, 0, IntPtr.Zero); //解决控件较多时,改变大小闪一下问题
setControls(newx, newy, cons);
SendMessage(cons.Handle, 0XB, 1, IntPtr.Zero);
cons.Invalidate(true);
}
}
}
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KonkeDemo
{
public class BaseConfig
{
private List<DeviceInfo> deviceInfos = new List<DeviceInfo>();
//private static string filepath;
public static string[] FilePath;
//private static double thresholdvalue;
public static double[] ThresholdValue;
private static string cameraFilePath1;
public static string CameraFilePath1
{
get { return cameraFilePath1; }
set { cameraFilePath1 = value; }
}
private static string cameraFilePath2;
public static string CameraFilePath2
{
get { return cameraFilePath2; }
set { cameraFilePath2 = value; }
}
private static double thresholdValue1;
public static double ThresholdValue1
{
get { return thresholdValue1; }
set { thresholdValue1 = value; }
}
private static double thresholdValue2;
public static double ThresholdValue2
{
get { return thresholdValue2; }
set { thresholdValue2 = value; }
}
private static int switchcnt;
public static int SwitchCnt
{
get { return switchcnt; }
set { switchcnt = value; }
}
private static int devicenumber;
public static int DeviceNumber
{
get { return devicenumber; }
set { devicenumber = value; }
}
private static string myDepartment;
public static string MyDepartment
{
get
{
return myDepartment;
}
set
{
myDepartment = value;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KonkeDemo
{
public class DeviceInfo
{
private SNInfo nInfo;
public SNInfo SNInfo
{
get { return nInfo; }
set { nInfo = value; }
}
private string ipaddress;
public string IpAddress
{
get { return ipaddress; }
set { ipaddress = value; }
}
private int iport;
public int Port
{
get { return iport; }
set { iport = value; }
}
private string tempbatchnumber;
public string TempbatchNumber
{
get { return tempbatchnumber; }
set { tempbatchnumber = value; }
}
private string tempMySAPB;
public string TempMySAPB
{
get
{
return tempMySAPB;
}
set
{
tempMySAPB = value;
}
}
private string tempfactoryId;
public string TempfactoryId
{
get { return tempfactoryId; }
set { tempfactoryId = value; }
}
private string tempfactoryLineId;
public string TempfactoryLineId
{
get { return tempfactoryLineId; }
set { tempfactoryLineId = value; }
}
private string tempGetJHH;
public string TempGetJHH
{
get { return tempGetJHH; }
set { tempGetJHH = value; }
}
private string tempproductmodel;
public string TempProductModel
{
get { return tempproductmodel; }
set { tempproductmodel = value; }
}
private string coordinatorPortName;
public string CoordinatorPortName
{
get
{
return coordinatorPortName;
}
set
{
coordinatorPortName = value;
}
}
private string keyboardPortName;
public string KeyBoardPortName
{
get
{
return keyboardPortName;
}
set
{
keyboardPortName = value;
}
}
private string powerPortName;
public string PowerPortName
{
get { return powerPortName; }
set { powerPortName = value; }
}
private string auxiliaryPortName;
public string AuxiliaryPortName
{
get { return auxiliaryPortName; }
set { auxiliaryPortName = value; }
}
private int socketovertime;
public int SocketOverTime
{
get { return socketovertime; }
set { socketovertime = value; }
}
private int portovertime;
public int PortOverTime
{
get { return portovertime; }
set { portovertime = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KonkeDemo
{
public class SNInfo
{
private string zjsn;
public string ZJSN
{
get
{
return zjsn;
}
set
{
zjsn = value;
}
}
private string keyboardsn;
public string KeyBoardSN
{
get
{
return keyboardsn;
}
set
{
keyboardsn = value;
}
}
private int keyboardid;
public int KeyBoardID
{
get { return keyboardid; }
set { keyboardid = value; }
}
private string powerpanelsn;
public string PowerPanelSN
{
get { return powerpanelsn; }
set { powerpanelsn = value; }
}
private int powerpanelid;
public int PowerPanelID
{
get { return powerpanelid; }
set { powerpanelid = value; }
}
private bool havebind;
public bool HaveBind
{
get { return havebind; }
set { havebind = value; }
}
private bool havetest;
public bool HaveTest
{
get { return havetest; }
set { havetest = value; }
}
private string softwareversion;
public string SoftWareVersion
{
get { return softwareversion; }
set { softwareversion = value; }
}
private string hardwareversion;
private string HardWareVersion
{
get { return hardwareversion; }
set { hardwareversion = value; }
}
private string mac;
public string Mac
{
get { return mac; }
set { mac = value; }
}
private string deviceid;
public string DeviceID
{
get
{
return deviceid;
}
set { deviceid = value; }
}
private int myrssi;
public int MyRssi
{
get
{
return myrssi;
}
set
{
myrssi = value;
}
}
private string devicetype;
public string DEVICEType
{
get { return devicetype; }
set { devicetype = value; }
}
private string installcode;
public string InstallCode
{
get
{
return installcode;
}
set
{
installcode = value;
}
}
private ushort shortaddr;
public ushort ShortAddr
{
get { return shortaddr; }
set { shortaddr = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KonkeDemo
{
public static class Helper
{
public enum CustomMessage
{
ViewLog,
QuerySN,
Alarm,
Stop,
Result,
Progress,
}
private static bool bstop;
public static bool Stop
{
get { return bstop; }
set { bstop = value; }
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>KonkeDemo</RootNamespace>
<AssemblyName>KonkeDemo</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.Data.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Design.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=365ac3cecbd70e0e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.Design.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Utils.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.Utils.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraBars.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraBars.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraEditors.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraEditors.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraEditors.v10.2.Design">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraEditors.v10.2.Design.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraGrid.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraGrid.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraLayout.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraLayout.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraLayout.v10.2.Design">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress10.2All\DevExpress.XtraLayout.v10.2.Design.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraNavBar.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraNavBar.v10.2.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraTreeList.v10.2">
<HintPath>..\..\..\workplace(管理客户端)\konkemanufactureclient\About\Libs\DevExpress\DevExpress.XtraTreeList.v10.2.dll</HintPath>
</Reference>
<Reference Include="HZH_Controls, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HZH_Controls.1.0.14\lib\net40\HZH_Controls.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="UIDemoProcess.cs" />
<Compile Include="AutoTestService.cs" />
<Compile Include="Entity\BaseConfig.cs" />
<Compile Include="ControlChangesWithWindows.cs" />
<Compile Include="UI\Configure.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Configure.Designer.cs">
<DependentUpon>Configure.cs</DependentUpon>
</Compile>
<Compile Include="Entity\DeviceInfo.cs" />
<Compile Include="UI\FormConfigure.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\FormConfigure.Designer.cs">
<DependentUpon>FormConfigure.cs</DependentUpon>
</Compile>
<Compile Include="UI\FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Helper.cs" />
<Compile Include="UI\Load.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Load.Designer.cs">
<DependentUpon>Load.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Entity\SNInfo.cs" />
<Compile Include="Control\UCNavigationMenuExt.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Control\UCNavigationMenuExt.Designer.cs">
<DependentUpon>UCNavigationMenuExt.cs</DependentUpon>
</Compile>
<Compile Include="Control\UCPanelTitle.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Control\UCPanelTitle.Designer.cs">
<DependentUpon>UCPanelTitle.cs</DependentUpon>
</Compile>
<Compile Include="Control\UCPanelTitleInfo.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Control\UCPanelTitleInfo.Designer.cs">
<DependentUpon>UCPanelTitleInfo.cs</DependentUpon>
</Compile>
<Compile Include="Control\UCProcessLine.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UIDemoInterface.cs" />
<Compile Include="Control\UserControlmodular.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Control\UserControlmodular.Designer.cs">
<DependentUpon>UserControlmodular.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="UI\FormConfigure.resx">
<DependentUpon>FormConfigure.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Control\UserControlmodular.resx">
<DependentUpon>UserControlmodular.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonkeDemo", "KonkeDemo.csproj", "{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A9E2491-A48C-4BD9-A537-E7F5A2B2D1E8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C0CC0C9A-0878-4D3C-8B6B-5A952C19C0B4}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LoadForm());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("KonkeDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KonkeDemo")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7a9e2491-a48c-4bd9-a537-e7f5a2b2d1e8")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace KonkeDemo.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KonkeDemo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace KonkeDemo.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
This diff is collapsed.
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 KonkeDemo
{
public partial class Configure : Form
{
public static Configure Configure_interface = null;
private string MyDepartment = "";//工厂信息
public string MyToolName = "";
public Configure()
{
InitializeComponent();
Configure_interface = this;
MyDepartment = LoadForm.Load_interface.GetRootDepartment();
InitControl();
}
private void InitControl()
{
btnConfigSerialPort.Click += BtnConfigSerialPort_Click;
btnConfigSerialPort.Visible = false;
FormComboBox.SelectedValueChanged += FormComboBox_SelectedValueChanged;
}
private void BtnConfigSerialPort_Click(object sender, EventArgs e)
{
try
{
}
catch (Exception ex)
{
MessageBox.Show("串口设置失败:" + ex.ToString());
}
}
#region 传递值
public string GetTempbatchNumber() //传递sap订单号
{
//return DEVName.Text;
return SAPDDH.Text.ToUpper();
}
public string GetMySAPB() //传递SAP编号
{
return SAPBH.Text.ToUpper();
}
public string GetMyToolName()
{
return MyToolName;
}
public string GetTempfactoryId() //传递工厂ID
{
return factoryIdText.Text;
}
public string GetTempfactoryLineId() //传递产线ID
{
return factoryLineIdText.Text;
}
public string GetProductModel() //传递设备型号
{
return ProductModel.Text;
}
public string GetProductName() //传递设备名称
{
return DevNameText.Text;
}
public string GetTempSVNumber() //传递sv
{
return SVNumber.Text;
}
public string GetTempHVNumber() //传递hv
{
return HVNumber.Text;
}
public string GetSerialSlogan1() //传递辅助串口1
{
return SerialSlogan1.Text;
}
public string GetproductID() //传递产品ID
{
return productID.Text;
}
public string GetMyRssi() //传递RSSI
{
return RSSIText.Text;
}
public int GetMyPowerH() //传递Power
{
string MyhighP = System.Text.RegularExpressions.Regex.Replace(HighPower.Text, @"[^0-9]+", "");
return Convert.ToInt16(MyhighP);
}
public int GetMyPowerL() //传递Power
{
string MyLowP = System.Text.RegularExpressions.Regex.Replace(LowPower.Text, @"[^0-9]+", "");
return Convert.ToInt16(MyLowP);
}
public string GetMyForm() //传递界面
{
return FormComboBox.Text;
}
public string GetJHH() //传递计划号
{
//return DEVName.Text;
return SAPDDH.Text.ToUpper();
}
public string GetWIFIName() //传递wifi名称
{
return SSIDName.Text;
}
public string GetLayout()
{
return comboBox1.Text;
}
#endregion
#region 窗口最大化控件变化
ControlChangesWithWindows ConfigureWindows = new ControlChangesWithWindows(); //随窗口改变大小类的实例化
private static int ConfigureColseAll = 1; //是否关闭所有窗口 1-关闭所有 0-关闭当前
//将控件的宽,高,左边距,顶边距和字体大小暂存到tag属性中
private void Configure_Load(object sender, EventArgs e)
{
try
{
btnLogWindow.Click += ConsoleShow_Click;
ConfigureWindows.MethodForLoad(this);//调用方法
}
catch (Exception ex)
{
MessageBox.Show("界面Load-操作失败:" + ex.ToString());
}
}
//根据窗体大小调整控件大小
private void Configure_Resize(object sender, EventArgs e)
{
try
{
int Width = this.Width;
int Height = this.Height;
if (Width >= 816 && Height >= 528)
{
this.AutoScroll = false;
ConfigureWindows.MethodForResize(this);//
}
else
this.AutoScroll = true;
}
catch (Exception ex)
{
MessageBox.Show("窗口改变大小-操作失败:" + ex.ToString());
}
}
#endregion
#region 页面切换
private void BackToLoad_Click(object sender, EventArgs e)
{
ConfigureColseAll = 0;
this.Close();
}
private void SerialSlogan1_MouseClick(object sender, MouseEventArgs e)
{
}
private void SerialSlogan2_MouseClick(object sender, MouseEventArgs e)
{
}
#endregion
#region 事件
//关闭时显示登陆界面
private void Configure_Closing(object sender, FormClosingEventArgs e)
{
try
{
if (ConfigureColseAll == 1)
System.Environment.Exit(0);
else
{
ConfigureColseAll = 1;
this.DialogResult = DialogResult.OK;
}
}
catch (Exception ex)
{
MessageBox.Show("操作界面关闭-操作失败:" + ex.ToString());
}
}
//点击确定,进入测试界面
private void ConfigureOK_Click(object sender, EventArgs e)
{
try
{
ConfigureText.Visible = false;
CreatePvtForm();
//验证正确,登陆配置界面
this.Hide(); //隐藏主界面
FormMain FCTest = new FormMain();
if (FCTest.ShowDialog() == DialogResult.OK) //以对话框形式显示配置界面
{
this.Show(); //显示主界面
}
}
catch (Exception ex)
{
MessageBox.Show("确定按钮-操作失败:" + ex.ToString());
}
}
private void DEVName_SelectedIndexChanged(object sender, EventArgs e)
{
GetSelectedItem();
}
private void GetSelectedItem()
{
try
{
if (DEVName.Text.Contains("请选择"))
{
return;
}
}
catch (Exception ex)
{
MessageBox.Show("选择工单-操作失败:" + ex.ToString());
}
}
#endregion
#region 测试阶段 + 测试界面的配置选择
private void XMLComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
BindProcessStepOption();
}
private void BindProcessStepOption(string Str = "")
{
FormComboBox.Items.Clear();
if (Str == "")
Str = XMLComboBox.Text;
}
private void FormComboBox_SelectedValueChanged(object sender, EventArgs e)
{
CreatePvtForm();
}
private void CreatePvtForm()
{
}
#endregion
private void DEVName_TextChanged(object sender, EventArgs e)
{
//Console.WriteLine("DEVName_TextChanged:{0}, [SelectedValue:{1}]", DEVName.Text, UtilControlDataBind.GetSelectedItemValue(DEVName));
GetSelectedItem();
}
private void ConsoleShow_Click(object sender, EventArgs e)
{
}
}
}
This diff is collapsed.
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 KonkeDemo
{
public partial class FormConfigure : Form
{
private BaseConfig newbaseConfig;
public FormConfigure()
{
InitializeComponent();
}
public FormConfigure(BaseConfig baseConfig)
{
InitializeComponent();
this.newbaseConfig = baseConfig;
}
}
}
<?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
This diff is collapsed.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
public partial class FormMain : Form
{
ControlChangesWithWindows LoadFormWindows = new ControlChangesWithWindows(); //随窗口改变大小类的实例化
private ConcurrentDictionary<int, UserControlmodular> ModularDictionary = new ConcurrentDictionary<int, UserControlmodular>();//双向链表
public FormMain()
{
InitializeComponent();
}
private void UIfresh()
{
this.WindowState = FormWindowState.Maximized;
string Layout = Configure.Configure_interface.GetLayout();
System.Windows.Forms.TableLayoutPanel tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
tableLayoutPanel1.AutoScroll = true;
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.Size = new System.Drawing.Size(1663, 571);
tableLayoutPanel1.TabIndex = 2;
panel2.Controls.Add(tableLayoutPanel1);
int iColumnCount = 3;
int iRowCount = 2;
iRowCount = int.Parse(Layout.Split(new string[] { "*" }, StringSplitOptions.RemoveEmptyEntries)[0]);
iColumnCount = int.Parse(Layout.Split(new string[] { "*" }, StringSplitOptions.RemoveEmptyEntries)[1]);
tableLayoutPanel1.ColumnCount = iColumnCount;
tableLayoutPanel1.RowCount = iRowCount;
UserControlmodular usermodular = new UserControlmodular();
float width = this.Width / iColumnCount;
if (width >= usermodular.Width)
{
for (int i = 0; i < iColumnCount; i++)
{
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
}
}
else
{
for (int i = 0; i < iColumnCount; i++)
{
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, usermodular.Width));
}
}
for (int k = 0; k < iRowCount; k++)
{
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, usermodular.Height));
}
int position = 0;
for (int i = 0; i < iRowCount; i++)
{
for (int j = 0; j < iColumnCount; j++)
{
usermodular = new UserControlmodular();
usermodular.BackColor = System.Drawing.Color.Aqua;
usermodular.Process = 0;
usermodular.iconclusion = 2;
usermodular.position = (++position);
usermodular.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
usermodular.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel1.Controls.Add(usermodular, j, i);
ModularDictionary.TryAdd(position, usermodular);
}
}
}
private void Form7_Load(object sender, EventArgs e)
{
UIfresh();
}
private void ucBtnExt3_BtnClick(object sender, EventArgs e)
{
Process.Start(AppDomain.CurrentDomain.BaseDirectory.ToString() + "Beacon.chm");
}
private void FormMain_Resize(object sender, EventArgs e)
{
LoadFormWindows.MethodForResize(this);
}
private void FillSN()
{
for (int i = 0; i < ModularDictionary.Count; i++)
{
if (string.IsNullOrEmpty(ModularDictionary[i + 1].SN))
{
ModularDictionary[i + 1].SN = textEdit1.Text.Trim();
textEdit1.Text = "";
break;
}
}
}
private void checkSN(out string ErrorMessage)
{
string errorlog = "";
for (int i = 0; i < ModularDictionary.Count; i++)
{
if (string.IsNullOrEmpty(ModularDictionary[i + 1].SN))
{
errorlog = string.Format("工站{0}请输入SN", i + 1);
break;
}
}
ErrorMessage = errorlog;
}
private void textEdit1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
FillSN();
}
private void ucBtnExt2_BtnClick(object sender, EventArgs e)
{
for (int i = 0; i < ModularDictionary.Count; i++)
{
ModularDictionary[i + 1].SN = "";
}
}
private void ucBtnExt1_BtnClick(object sender, EventArgs e)
{
if (ucBtnExt1.BtnText == "开始")
{
string ErrorMessage = "";
checkSN(out ErrorMessage);
if (string.IsNullOrEmpty(ErrorMessage))
{
ucBtnExt1.BtnText = "停止";
textEdit1.Enabled = false;
ucBtnExt2.Enabled = false;
ucBtnExt4.Enabled = false;
ucBtnExt3.Enabled = false;
AutoTestService autoTestService = new AutoTestService(ModularDictionary);
autoTestService.Run(null);
ucBtnExt1.BtnText = "开始";
ucBtnExt2.Enabled = true;
ucBtnExt4.Enabled = true;
ucBtnExt3.Enabled = true;
textEdit1.Enabled = true;
}
else
{
MessageBox.Show(ErrorMessage);
}
}
else if (ucBtnExt1.BtnText == "停止")
{
AutoTestService autoTest = new AutoTestService();
autoTest.Stop();
ucBtnExt1.BtnText = "开始";
ucBtnExt2.Enabled = true;
ucBtnExt4.Enabled = true;
ucBtnExt3.Enabled = true;
}
}
private void ucBtnExt4_BtnClick(object sender, EventArgs e)
{
AutoTestService autoTest = new AutoTestService();
BaseConfig baseConfig = autoTest.GetConfig();
FormConfigure configure = new FormConfigure();
if (configure.ShowDialog(this) == DialogResult.OK)
{
autoTest.SetConfig(baseConfig);
}
}
}
}
<?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
namespace KonkeDemo
{
partial class LoadForm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoadForm));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.PassnameText = new System.Windows.Forms.TextBox();
this.PasswordText = new System.Windows.Forms.TextBox();
this.LoadButton = new System.Windows.Forms.Button();
this.LoadErrorText = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SignOut = new System.Windows.Forms.Button();
this.LoadTextShow = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(455, 86);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 15);
this.label1.TabIndex = 0;
this.label1.Text = "账号:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(455, 154);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(52, 15);
this.label2.TabIndex = 1;
this.label2.Text = "密码:";
//
// PassnameText
//
this.PassnameText.BackColor = System.Drawing.Color.Lavender;
this.PassnameText.Location = new System.Drawing.Point(547, 82);
this.PassnameText.Margin = new System.Windows.Forms.Padding(4);
this.PassnameText.Name = "PassnameText";
this.PassnameText.Size = new System.Drawing.Size(191, 25);
this.PassnameText.TabIndex = 2;
this.PassnameText.Text = "surukun";
this.PassnameText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PassNameEnter);
//
// PasswordText
//
this.PasswordText.BackColor = System.Drawing.Color.Lavender;
this.PasswordText.Location = new System.Drawing.Point(547, 142);
this.PasswordText.Margin = new System.Windows.Forms.Padding(4);
this.PasswordText.Name = "PasswordText";
this.PasswordText.PasswordChar = '*';
this.PasswordText.Size = new System.Drawing.Size(191, 25);
this.PasswordText.TabIndex = 3;
this.PasswordText.Text = "123456";
this.PasswordText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PassWordEnter);
//
// LoadButton
//
this.LoadButton.Location = new System.Drawing.Point(457, 290);
this.LoadButton.Margin = new System.Windows.Forms.Padding(4);
this.LoadButton.Name = "LoadButton";
this.LoadButton.Size = new System.Drawing.Size(99, 39);
this.LoadButton.TabIndex = 6;
this.LoadButton.Text = "登陆";
this.LoadButton.UseVisualStyleBackColor = true;
this.LoadButton.Click += new System.EventHandler(this.LoadButton_Click);
//
// LoadErrorText
//
this.LoadErrorText.AutoSize = true;
this.LoadErrorText.ForeColor = System.Drawing.Color.Red;
this.LoadErrorText.Location = new System.Drawing.Point(455, 244);
this.LoadErrorText.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.LoadErrorText.Name = "LoadErrorText";
this.LoadErrorText.Size = new System.Drawing.Size(157, 15);
this.LoadErrorText.TabIndex = 7;
this.LoadErrorText.Text = "账号不存在或密码错误";
this.LoadErrorText.Visible = false;
//
// pictureBox1
//
//this.pictureBox1.Image = global::WindowsFormsApp7.Properties.Resources.KongKe;
this.pictureBox1.Location = new System.Drawing.Point(72, 71);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(257, 258);
this.pictureBox1.TabIndex = 8;
this.pictureBox1.TabStop = false;
//
// SignOut
//
this.SignOut.Location = new System.Drawing.Point(640, 290);
this.SignOut.Margin = new System.Windows.Forms.Padding(4);
this.SignOut.Name = "SignOut";
this.SignOut.Size = new System.Drawing.Size(99, 39);
this.SignOut.TabIndex = 9;
this.SignOut.Text = "退出";
this.SignOut.UseVisualStyleBackColor = true;
this.SignOut.Click += new System.EventHandler(this.SignOut_Click);
//
// LoadTextShow
//
this.LoadTextShow.AutoSize = true;
this.LoadTextShow.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
this.LoadTextShow.Location = new System.Drawing.Point(544, 190);
this.LoadTextShow.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.LoadTextShow.Name = "LoadTextShow";
this.LoadTextShow.Size = new System.Drawing.Size(160, 15);
this.LoadTextShow.TabIndex = 10;
this.LoadTextShow.Text = "登陆中,请等待......";
this.LoadTextShow.Visible = false;
//
// LoadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Lavender;
this.ClientSize = new System.Drawing.Size(801, 431);
this.Controls.Add(this.LoadTextShow);
this.Controls.Add(this.SignOut);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.LoadErrorText);
this.Controls.Add(this.LoadButton);
this.Controls.Add(this.PasswordText);
this.Controls.Add(this.PassnameText);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
//this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "LoadForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "登陆 Ver2.2.6";
this.Load += new System.EventHandler(this.LoadForm_Load);
this.Resize += new System.EventHandler(this.LoadForm_Resize);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox PassnameText;
private System.Windows.Forms.TextBox PasswordText;
private System.Windows.Forms.Button LoadButton;
private System.Windows.Forms.Label LoadErrorText;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button SignOut;
private System.Windows.Forms.Label LoadTextShow;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KonkeDemo
{
public partial class LoadForm : Form //登陆界面
{
public static LoadForm Load_interface = null; //用于将账号类型传给子窗口
public LoadForm()
{
InitializeComponent();
Load_interface = this; //用于将账号类型传给子窗口
}
//窗口最大化控件变化 - start
ControlChangesWithWindows LoadFormWindows = new ControlChangesWithWindows(); //随窗口改变大小类的实例化
private int RootType = 0;
private string RootName = "Unknow";
private string RootPW = "";
private string RootDepartment = "";
private void LoadXmlFile(string URL, string FileName)
{
try
{
}
catch
{
}
}
private void LoadConfigsFile()
{
}
//将控件的宽,高,左边距,顶边距和字体大小暂存到tag属性中
private void LoadForm_Load(object sender, EventArgs e)
{
LoadFormWindows.MethodForLoad(this);//调用方法
}
//根据窗体大小调整控件大小
private void LoadForm_Resize(object sender, EventArgs e)
{
try
{
int Width = this.Width;
int Height = this.Height;
if (Width >= 617 && Height >= 384)
{
this.AutoScroll = false;
LoadFormWindows.MethodForResize(this);//随窗体改变控件大小
}
else
this.AutoScroll = true;
}
catch (Exception ex)
{
MessageBox.Show("窗体大小改变-操作失败:" + ex.ToString());
}
}
//登陆操作 - start
[DllImport(".\\barcodex.ocx")]
public static extern int DllRegisterServer();//用于注册barcodex.OCX文件,用于生成条形码的控件
public int GetTempType() //用于将账号类型传给子窗口
{
return RootType;
}
public string GetRootName() //用于将账号名称传给子窗口
{
return RootName;
}
public string GetRootPW() //用于将账号密码传给子窗口
{
return RootPW;
}
public string GetRootDepartment() //用于将工厂信息传给子窗口
{
return RootDepartment;
}
//登陆按钮,检查账号密码是否正确,是否选择设备类型
private void LoadButton_Click(object sender, EventArgs e)
{
try
{
LoadTextShow.Visible = true; //登录提示
LoadErrorText.Visible = false; //隐藏错误提示框
RootName = PassnameText.Text;
Dictionary<string, object> dicPara = new Dictionary<string, object>
{
{ "item", "loginAccount" },
{ "value", PassnameText.Text.Trim() }
};
if (PassnameText.Text.Trim() == "surukun"
&& PasswordText.Text.Trim() == "123456")
{
this.Hide();
Configure ConfigureWindows = new Configure();
if (ConfigureWindows.ShowDialog() == DialogResult.OK) //以对话框形式显示配置界面
{
//this.Show(); //显示主界面
}
}
LoadTextShow.Visible = false;
LoadErrorText.Visible = true;//显示错误提示框
}
catch (Exception ex)
{
LoadErrorText.Text = "登录异常";
LoadTextShow.Visible = false;
LoadErrorText.Visible = true;//显示错误提示框
MessageBox.Show("登录异常:请检查网络后重试");
}
}
private bool CheckClientKey(string userName, string password)
{
return true;
}
private void PassNameEnter(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
PasswordText.Focus(); //将焦点设置到密码输入框
}
private void PassWordEnter(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
this.LoadButton_Click(sender, e); //点击名为LoadButton按键,即登陆
}
private void SignOut_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KonkeDemo
{
public class UIDemoInterface
{
public virtual string CheckInput(string strData)
{
return string.Empty;
}
public virtual SNInfo GetSNInfo(string sn)
{
return new SNInfo();
}
public virtual BaseConfig GetConfig()
{
return new BaseConfig();
}
public virtual void SetConfig(BaseConfig baseconfig) { }
public virtual void Run(DeviceInfo deviceinfo) { }
public virtual void Stop() { }
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment