第一次提交至Git

This commit is contained in:
2024-03-11 16:32:52 +08:00
commit 3f6c4d62b9
2865 changed files with 2172317 additions and 0 deletions

View File

@@ -0,0 +1,119 @@

Namespace UTSModule.Test.Controls
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class UtsInputBox
Inherits System.Windows.Forms.Form
'Form 重写 Dispose以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.BtnOk = New System.Windows.Forms.Button()
Me.BtnCencle = New System.Windows.Forms.Button()
Me.TxtInputText = New System.Windows.Forms.TextBox()
Me.LblTip = New System.Windows.Forms.Label()
Me.TableLayoutPanel1.SuspendLayout
Me.SuspendLayout
'
'TableLayoutPanel1
'
Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.TableLayoutPanel1.ColumnCount = 2
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Controls.Add(Me.BtnOk, 0, 0)
Me.TableLayoutPanel1.Controls.Add(Me.BtnCencle, 1, 0)
Me.TableLayoutPanel1.Location = New System.Drawing.Point(277, 122)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 1
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 27)
Me.TableLayoutPanel1.TabIndex = 0
'
'BtnOk
'
Me.BtnOk.Anchor = System.Windows.Forms.AnchorStyles.None
Me.BtnOk.Location = New System.Drawing.Point(3, 3)
Me.BtnOk.Name = "BtnOk"
Me.BtnOk.Size = New System.Drawing.Size(67, 21)
Me.BtnOk.TabIndex = 0
Me.BtnOk.Text = "确定"
'
'BtnCencle
'
Me.BtnCencle.Anchor = System.Windows.Forms.AnchorStyles.None
Me.BtnCencle.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.BtnCencle.Location = New System.Drawing.Point(76, 3)
Me.BtnCencle.Name = "BtnCencle"
Me.BtnCencle.Size = New System.Drawing.Size(67, 21)
Me.BtnCencle.TabIndex = 1
Me.BtnCencle.Text = "取消"
'
'TxtInputText
'
Me.TxtInputText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
Me.TxtInputText.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TxtInputText.ImeMode = System.Windows.Forms.ImeMode.Disable
Me.TxtInputText.Location = New System.Drawing.Point(12, 90)
Me.TxtInputText.Name = "TxtInputText"
Me.TxtInputText.Size = New System.Drawing.Size(411, 26)
Me.TxtInputText.TabIndex = 1
'
'LblTip
'
Me.LblTip.AutoEllipsis = true
Me.LblTip.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134,Byte))
Me.LblTip.Location = New System.Drawing.Point(12, 9)
Me.LblTip.Name = "LblTip"
Me.LblTip.Size = New System.Drawing.Size(408, 78)
Me.LblTip.TabIndex = 2
Me.LblTip.Text = "Label1"
Me.LblTip.TextAlign = System.Drawing.ContentAlignment.BottomLeft
'
'UtsInputBox
'
Me.AcceptButton = Me.BtnOk
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.BtnCencle
Me.ClientSize = New System.Drawing.Size(435, 160)
Me.Controls.Add(Me.LblTip)
Me.Controls.Add(Me.TxtInputText)
Me.Controls.Add(Me.TableLayoutPanel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = false
Me.MinimizeBox = false
Me.Name = "UtsInputBox"
Me.ShowInTaskbar = false
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "UtsInputBox"
Me.TopMost = true
Me.TableLayoutPanel1.ResumeLayout(false)
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents BtnOk As System.Windows.Forms.Button
Friend WithEvents BtnCencle As System.Windows.Forms.Button
Friend WithEvents TxtInputText As Windows.Forms.TextBox
Friend WithEvents LblTip As Windows.Forms.Label
End Class
End Namespace

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,120 @@
Imports System.Threading
Imports System.Windows.Forms
Imports UTS_Core.UTSModule.Test.StatusMonitor.UtsKeyValueMonitor
Namespace UTSModule.Test.Controls
Public Class UtsInputBox
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOk.Click
InputText = TxtInputText.Text
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCencle.Click
InputText = Nothing
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private _isPwd As Boolean = False
Public Property TipText As String
Public Property Title As String
Public Property DefaultText As String
''' <summary>
''' 输入框值
''' </summary>
''' <returns></returns>
Public Property InputText() As String
''' <summary>
''' 密码模式
''' </summary>
''' <returns></returns>
Public Property IsPassWord As Boolean
Get
Return _isPwd
End Get
Set(value As Boolean)
_isPwd = value
If _isPwd Then
TxtInputText.PasswordChar = "*"c
Else
TxtInputText.PasswordChar = ControlChars.NullChar
End If
End Set
End Property
Public Overloads Shared Function ShowDialog(tip As String, Optional title As String = "", Optional text As String = "", Optional isPwd As Boolean = False) As String
Using box As New UtsInputBox
box.TipText = tip
box.Title = title
box.DefaultText = text
box.IsPassWord = isPwd
box.ShowDialog()
Return box.InputText
End Using
End Function
Private Sub UpdateKey(key As UtsKeyValueEnum)
Try
If BtnOk.InvokeRequired Then
BtnOk.Invoke(New Action(Of UtsKeyValueEnum)(AddressOf UpdateKey), New Object() {key})
Return
End If
Catch ex As Exception
Return
End Try
If key = UtsKeyValueEnum.Yes Then
InputText = TxtInputText.Text
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
ElseIf key = UtsKeyValueEnum.No Then
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End If
End Sub
Private Sub UtsInputBox_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Text = Title
LblTip.Text = TipText
If _isPwd Then
TxtInputText.PasswordChar = "*"c
Else
TxtInputText.PasswordChar = ControlChars.NullChar
End If
TxtInputText.Text = DefaultText
TxtInputText.Focus()
TxtInputText.SelectAll()
AcceptButton = BtnOk
CancelButton = BtnCencle
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf CheckKeyValue))
End Sub
Sub CheckKeyValue(obj As Object)
While DialogResult = DialogResult.None
UpdateKey(UtsKeyValue)
System.Windows.Forms.Application.DoEvents()
Thread.Sleep(50)
End While
End Sub
Private Sub UtsInputBox_KeyDown(sender As Object, e As Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Enter Then
BtnOk.PerformClick()
End If
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,86 @@

Namespace UTSModule.Test.Controls
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class UtsMsgBox
Inherits System.Windows.Forms.Form
'Form 重写 Dispose以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.BtnYes = New System.Windows.Forms.Button()
Me.BtnNo = New System.Windows.Forms.Button()
Me.LblTipText = New System.Windows.Forms.Label()
Me.SuspendLayout
'
'BtnYes
'
Me.BtnYes.Anchor = System.Windows.Forms.AnchorStyles.None
Me.BtnYes.Location = New System.Drawing.Point(252, 120)
Me.BtnYes.Name = "BtnYes"
Me.BtnYes.Size = New System.Drawing.Size(67, 21)
Me.BtnYes.TabIndex = 0
Me.BtnYes.Text = "确定"
'
'BtnNo
'
Me.BtnNo.Anchor = System.Windows.Forms.AnchorStyles.None
Me.BtnNo.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.BtnNo.Location = New System.Drawing.Point(325, 120)
Me.BtnNo.Name = "BtnNo"
Me.BtnNo.Size = New System.Drawing.Size(67, 21)
Me.BtnNo.TabIndex = 1
Me.BtnNo.Text = "取消"
'
'LblTipText
'
Me.LblTipText.AutoEllipsis = true
Me.LblTipText.Font = New System.Drawing.Font("宋体", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134,Byte))
Me.LblTipText.Location = New System.Drawing.Point(31, 22)
Me.LblTipText.Name = "LblTipText"
Me.LblTipText.Size = New System.Drawing.Size(361, 82)
Me.LblTipText.TabIndex = 1
Me.LblTipText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'UtsMsgBox
'
Me.AcceptButton = Me.BtnYes
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.BtnNo
Me.ClientSize = New System.Drawing.Size(426, 153)
Me.Controls.Add(Me.BtnNo)
Me.Controls.Add(Me.BtnYes)
Me.Controls.Add(Me.LblTipText)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = false
Me.MinimizeBox = false
Me.Name = "UtsMsgBox"
Me.ShowInTaskbar = false
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "UtsMsgBox"
Me.TopMost = true
Me.ResumeLayout(false)
End Sub
Friend WithEvents BtnYes As System.Windows.Forms.Button
Friend WithEvents BtnNo As System.Windows.Forms.Button
Friend WithEvents LblTipText As Windows.Forms.Label
End Class
End Namespace

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,91 @@
Imports UTS_Core.UTSModule.Test.StatusMonitor.UtsKeyValueMonitor
Namespace UTSModule.Test.Controls
Public Class UtsMsgBox
Enum UtsMsgBoxTypeEnum
OkOnly = 0
YesNo = 4
End Enum
Public Property MsgType() As UtsMsgBoxTypeEnum
Public Property MsgText() As String
Public Property MsgTitle() As String
Public Overloads Shared Function ShowDialog(text As String, Optional type As UtsMsgBoxTypeEnum = UtsMsgBoxTypeEnum.OkOnly, Optional title As String = "") As System.Windows.Forms.DialogResult
Using msg As New UtsMsgBox
msg.MsgText = text
msg.MsgType = type
msg.MsgTitle = title
Return msg.ShowDialog()
End Using
End Function
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnYes.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNo.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub UtsMsgBox_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Text = MsgTitle
LblTipText.Text = MsgText
If MsgType = UtsMsgBoxTypeEnum.OkOnly Then
AcceptButton = BtnYes
BtnNo.Visible = False
BtnYes.Text = $"确定"
BtnYes.Width += BtnNo.Width
ElseIf MsgType = UtsMsgBoxTypeEnum.YesNo Then
AcceptButton = BtnYes
CancelButton = BtnNo
BtnYes.Text = $""
BtnNo.Text = $""
End If
AddHandler StatusMonitor.UtsKeyValueMonitor.UtsKeyDown, AddressOf UtsKeyDownCallback
End Sub
Private Sub UtsKeyDownCallback(sender As Object, e As StatusMonitor.UtsKeyDownEventArgs)
If BtnYes.InvokeRequired Then
BtnYes.Invoke(New Action(Of StatusMonitor.UtsKeyValueMonitor.UtsKeyValueEnum)(AddressOf UpdateKey), New Object() {e.KeyValue})
Else
UpdateKey(e.KeyValue)
End If
End Sub
Private Sub UpdateKey(key As UtsKeyValueEnum)
Try
If BtnYes.InvokeRequired Then
BtnYes.Invoke(New Action(Of UtsKeyValueEnum)(AddressOf UpdateKey), New Object() {key})
Return
End If
Catch ex As Exception
Return
End Try
If key = UtsKeyValueEnum.Yes Then
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
ElseIf key = UtsKeyValueEnum.No Then
If MsgType = UtsMsgBoxTypeEnum.YesNo Then
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End If
End If
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,255 @@
Imports System.Drawing
Imports System.Threading
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class utsLabel
'Inherits System.Windows.Forms.UserControl
Inherits System.Windows.Forms.Label
'UserControl 重写释放以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
If myThread IsNot Nothing AndAlso myThread.IsAlive Then
'关闭线程
myThread.Abort()
End If
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
Dim myThread As Thread = Nothing '定义一个全局变量存储线程对象
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = False 'Momo 2023-12-23 禁用跨线程检查,危险,少用
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(0, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(100, 23)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Label1"
Me.Label1.TextAlign = ContentAlignment.MiddleLeft
Me.ResumeLayout(False)
If myThread IsNot Nothing AndAlso myThread.IsAlive Then
'如果已经有线程正在运行,则先关闭该线程
myThread.Abort()
End If
'创建新的线程并开始运行
myThread = New Thread(AddressOf dispModeExe)
myThread.Start()
End Sub
Friend WithEvents Label1 As Windows.Forms.Label
#Region "控件属性"
Private _dispMode As Integer '显示模式 1-普通2-闪烁3-滚动4-自动增加字符
Private _visible As Boolean '是否显示’
Private _text As String '显示文本内容’
Private _dispFlag As Boolean '闪烁flag
Private _modePara As String '模式参数’
Private modePara_Timeout_mS As Integer = 0 '闪烁超时’
Private color_1 As Color = Color.Red '闪烁颜色1
Private color_2 As Color = Color.White '闪烁颜色2
Private AddCharacter As String = "." '自增字母’
Private AddCharMaxLen As Integer = 32 '自增最大长度’
Private modeParaArry() As String '参数数组’
Private AddCharCnt As Integer = 0 '自增计数’
Public Property modePara As String
Get
Return _modePara
End Get
Set(value As String)
_modePara = value
End Set
End Property
Public Property dispMode As Integer
Get
Return _dispMode
End Get
Set(value As Integer)
_dispMode = value
RunMode()
End Set
End Property
#End Region
#Region "控件属性实现"
''' <summary>
''' 解析模式,并且确定有关参数
''' </summary>
Private Sub RunMode()
If IsNumeric(_dispMode) = False Then Return
If String.IsNullOrEmpty(_modePara) = True Then
Return
Else
modeParaArry = _modePara.Split(CType(":", Char()))
End If
Dim paraArryCnt As Integer = modeParaArry.Count
Select Case _dispMode
Case 1 '默认
Case 2 '闪烁
If paraArryCnt = 3 Then
modePara_Timeout_mS = CInt(modeParaArry(0))
color_1 = HexStringToColor(modeParaArry(1).Trim)
color_2 = HexStringToColor(modeParaArry(2).Trim)
Else
Return
End If
Case 3 '滚动
Case 4 '自动增加字符
If paraArryCnt = 3 Then
modePara_Timeout_mS = CInt(modeParaArry(0))
AddCharacter = modeParaArry(1).Trim
AddCharMaxLen = CInt(modeParaArry(2).Trim)
AddCharCnt = 0
Else
Return
End If
Case Else
End Select
End Sub
''' <summary>
''' 常驻线程执行各种Mode
''' </summary>
Private Async Sub dispModeExe()
While True
Await Task.Delay(modePara_Timeout_mS)
_dispFlag = Not _dispFlag
ModeProcessing()
End While
End Sub
Private Sub ModeProcessing()
If IsNumeric(_dispMode) = False Then Return
Select Case _dispMode
Case 1 '默认
Case 2 '闪烁
If _dispFlag Then
ForeColor = color_1
Else
ForeColor = color_2
End If
Case 3 '滚动
Case 4 '自动增加字符
If AddCharCnt < AddCharMaxLen Then
AddCharCnt += 1
_text = _text & AddCharacter
MyBase.Text = _text '调用基类的Text属性的setter方法将处理后的值赋值给基类的Text属性
Me.Refresh() ' 在修改Text后调用Refresh方法刷新控件
'If _dispFlag Then
' ForeColor = color_1
'Else
' ForeColor = color_2
'End If
End If
Case Else
End Select
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
' 重写OnPaint事件处理程序这里不需要进行任何操作
MyBase.OnPaint(e)
End Sub
Protected Overloads Sub show()
MyBase.Show()
End Sub
Public Overrides Property Text As String
Get
'Return MyBase.Text '返回基类的Text属性值
Return _text
End Get
Set(value As String)
_text = value
MyBase.Text = _text '调用基类的Text属性的setter方法将处理后的值赋值给基类的Text属性
Me.Refresh() ' 在修改Text后调用Refresh方法刷新控件
End Set
End Property
Private Function HexStringToColor(hexString As String) As Color
Dim val As Integer = Convert.ToInt32(hexString, 16)
Return Color.FromArgb(val >> 16 And &HFF, val >> 8 And &HFF, val And &HFF)
End Function
#End Region
End Class
Public Class TickCounter
<DllImport("kernel32.dll")>
Private Shared Function GetTickCount() As Integer
End Function
Public Shared _msLast As Long
Public Shared ReadOnly Property ElapsedMilliseconds As Long
Get
Return CLng(GetTickCount())
End Get
End Property
Public Shared Property msLast As Long
Get
Return _msLast
End Get
Set(value As Long)
_msLast = value
End Set
End Property
End Class

View File

@@ -0,0 +1,126 @@
<?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="Label1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -0,0 +1,13 @@
Imports System.Threading
Imports System.Windows.Forms
Imports UTS_Core.UTSModule.Test.StatusMonitor.UtsKeyValueMonitor
Namespace UTSModule.Test.Controls
Public Class utsLabel
Inherits Label
End Class
End Namespace