initial commit
This commit is contained in:
170
CEnergy/ArinClassV2/Common.vb
Normal file
170
CEnergy/ArinClassV2/Common.vb
Normal file
@@ -0,0 +1,170 @@
|
||||
Imports Microsoft.Win32
|
||||
Imports System.IO
|
||||
Imports System.Net.NetworkInformation
|
||||
Imports System.Net
|
||||
Imports System.Net.Dns
|
||||
Imports System.net.Mail
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class ARINCLASS
|
||||
|
||||
Public Shared Sub SaveLoad_FrmSetting(ByVal Frm As Form, ByRef LastPos As Short, Optional ByVal Save As Boolean = False, Optional ByVal RestoreStatus As Boolean = False)
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
|
||||
Dim Width As Short
|
||||
Dim Height As Short
|
||||
Dim State As Short
|
||||
Dim Left, Top As Short
|
||||
If Save Then
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
INI.Write(Frm.Name, "state", Frm.WindowState)
|
||||
INI.Write(Frm.Name, "width", Frm.Width)
|
||||
INI.Write(Frm.Name, "height", Frm.Height)
|
||||
INI.Write(Frm.Name, "left", Frm.Left)
|
||||
INI.Write(Frm.Name, "top", Frm.Top)
|
||||
INI.Write(Frm.Name, "LastPos", LastPos)
|
||||
Else
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
If Frm.WindowState = FormWindowState.Normal Then
|
||||
Width = INI.Read(Frm.Name, "width", 0)
|
||||
Height = INI.Read(Frm.Name, "height", 0)
|
||||
State = INI.Read(Frm.Name, "state", -1)
|
||||
Left = INI.Read(Frm.Name, "left", 0)
|
||||
Top = INI.Read(Frm.Name, "top", 0)
|
||||
LastPos = INI.Read(Frm.Name, "LastPos", 0)
|
||||
If Width <> 0 Then Frm.Width = Width
|
||||
If Height <> 0 Then Frm.Height = Height
|
||||
If RestoreStatus Then If State <> -1 Then Frm.WindowState = State
|
||||
If Left <> 0 Then Frm.Left = Left
|
||||
If Top <> 0 Then Frm.Top = Top
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Public Shared Function Read_LastPos_Frm(ByVal Frm As Form) As Short
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
Return INI.Read(Frm.Name, "LastPos", 0)
|
||||
End Function
|
||||
Public Shared Function Read_LastPos_Frm(ByVal FrmName As String) As Short
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
Return INI.Read(FrmName, "LastPos", 0)
|
||||
End Function
|
||||
Public Shared Sub Save_LastPos_Frm(ByVal FrmName As String, ByVal LastPos As Short)
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
INI.Write(FrmName, "LastPos", LastPos)
|
||||
End Sub
|
||||
|
||||
Public Shared Function Read_LastZone(ByVal FrmName As String) As String
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
Return INI.Read(FrmName, "LastZone", "")
|
||||
End Function
|
||||
Public Shared Sub Save_LastZone(ByVal FrmName As String, ByVal LastPos As String)
|
||||
'//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
'If Frm.FormBorderStyle <> FormBorderStyle.Sizable AndAlso Frm.FormBorderStyle <> FormBorderStyle.SizableToolWindow Then Return
|
||||
Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\Frm_Setting.ini")
|
||||
INI.Write(FrmName, "LastZone", LastPos)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Shared Sub NOTICE(ByVal MSG As String, ByVal Src As Object)
|
||||
On Error Resume Next
|
||||
If Src.GetType.Name.ToUpper = "TOOLSTRIPSTATUSLABEL" Then
|
||||
CType(Src, Windows.Forms.ToolStripStatusLabel).Text = "<EFBFBD><EFBFBD> " & MSG & Space(1)
|
||||
ElseIf Src.GetType.Name.ToUpper = "LABEL" Then
|
||||
CType(Src, Windows.Forms.Label).Text = "<EFBFBD><EFBFBD> " & MSG & Space(1)
|
||||
End If
|
||||
End Sub
|
||||
Public Shared Sub NOTICE(ByVal MSG As String, ByVal FCOLOR As Drawing.Color, ByVal Src As Windows.Forms.ToolStripStatusLabel)
|
||||
Src.Text = "<EFBFBD><EFBFBD> " & MSG & Space(1)
|
||||
Src.ForeColor = FCOLOR
|
||||
End Sub
|
||||
Public Shared Sub NOTICE(ByVal MSG As String, ByVal Src As Windows.Forms.ToolStripStatusLabel, ByVal FCOLOR As Drawing.Color)
|
||||
Src.Text = "<EFBFBD><EFBFBD> " & MSG & Space(1) & "[" & Format(Now, "HH<EFBFBD><EFBFBD>mm<EFBFBD><EFBFBD>ss<EFBFBD><EFBFBD>") & "]"
|
||||
Src.ForeColor = FCOLOR
|
||||
If FCOLOR = Drawing.Color.Red Then My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep)
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' <20><><EFBFBD><EFBFBD> ǥ<><C7A5><EFBFBD>մϴ<D5B4>.
|
||||
''' </summary>
|
||||
''' <param name="fForm"></param>
|
||||
''' <param name="MdiMainForm"></param>
|
||||
''' <param name="MODALFORM"></param>
|
||||
''' <param name="Fstate"></param>
|
||||
''' <remarks></remarks>
|
||||
Public Shared Sub ShowForm(ByVal fForm As System.Windows.Forms.Form, ByVal MdiMainForm As System.Windows.Forms.Form, Optional ByVal MODALFORM As Boolean = False, Optional ByVal Fstate As System.Windows.Forms.FormWindowState = System.Windows.Forms.FormWindowState.Normal)
|
||||
Dim objForms As System.Windows.Forms.Form
|
||||
Dim ALREADY As Boolean = False
|
||||
|
||||
If MdiMainForm Is Nothing Then
|
||||
If MODALFORM Then
|
||||
fForm.ShowDialog()
|
||||
Else
|
||||
fForm.Show()
|
||||
End If
|
||||
fForm.Activate()
|
||||
Return
|
||||
End If
|
||||
|
||||
Try
|
||||
For Each objForms In MdiMainForm.MdiChildren
|
||||
If objForms.Name = fForm.Name Then
|
||||
ALREADY = True
|
||||
'fForm.Dispose()
|
||||
'fForm = Nothing
|
||||
objForms.Focus()
|
||||
Return
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
If ALREADY = False Then
|
||||
With fForm
|
||||
If MdiMainForm Is Nothing Then
|
||||
MsgBox("MDI <20>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ϴ<EFBFBD>", MsgBoxStyle.Critical, "error")
|
||||
Else
|
||||
If Not MdiMainForm Is Nothing Then
|
||||
.MdiParent = MdiMainForm
|
||||
'.StartPosition = FormStartPosition.CenterParent
|
||||
End If
|
||||
.WindowState = Fstate
|
||||
If MODALFORM Then
|
||||
.ShowDialog()
|
||||
Else
|
||||
.Show()
|
||||
End If
|
||||
End If
|
||||
End With
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD> Ȯ<><C8AE><EFBFBD>մϴ<D5B4>.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function PrevInstance() As Boolean
|
||||
If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user