51 lines
1.8 KiB
VB.net
51 lines
1.8 KiB
VB.net
|
|
Public Class PowerSupplycontroller : Inherits PowerSupplyBase
|
|||
|
|
Public Sub New(g_tabControl As TabControl)
|
|||
|
|
L_TabControl = g_tabControl
|
|||
|
|
End Sub
|
|||
|
|
Public Overrides Function AddForm(pst As PowerSupplyType, formname As String, formtitle As String, ParamArray par() As Object) As Boolean
|
|||
|
|
If L_TabControl.TabPages.ContainsKey(formname) Then Return True
|
|||
|
|
Dim page As New TabPage With {.Name = formname, .Text = formtitle}
|
|||
|
|
Dim result As Boolean = False
|
|||
|
|
Select Case pst
|
|||
|
|
Case PowerSupplyType.PowerSupplyForm
|
|||
|
|
Dim frm = New PowerSupplyForm()
|
|||
|
|
frm.SetFormPattern(par)
|
|||
|
|
result = ShowForm(frm, page)
|
|||
|
|
End Select
|
|||
|
|
|
|||
|
|
Return result
|
|||
|
|
|
|||
|
|
End Function
|
|||
|
|
Public Function ShowForm(frm As Form, parentControl As Control) As Boolean
|
|||
|
|
If frm Is Nothing Then Return False
|
|||
|
|
With frm
|
|||
|
|
.FormBorderStyle = FormBorderStyle.None
|
|||
|
|
.TopLevel = False
|
|||
|
|
.Dock = DockStyle.Fill
|
|||
|
|
.Parent = parentControl
|
|||
|
|
|
|||
|
|
.Enabled = True
|
|||
|
|
|
|||
|
|
.Show()
|
|||
|
|
End With
|
|||
|
|
L_TabControl.TabPages.Add(parentControl)
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Overrides Sub RemoveForm(pst As PowerSupplyType)
|
|||
|
|
If L_TabControl.TabPages.ContainsKey([Enum].GetName(GetType(PowerSupplyType), pst)) Then
|
|||
|
|
Dim page As TabPage = L_TabControl.TabPages([Enum].GetName(GetType(PowerSupplyType), pst))
|
|||
|
|
page.Parent = Nothing
|
|||
|
|
' page.Dispose()
|
|||
|
|
L_TabControl.TabPages.RemoveByKey([Enum].GetName(GetType(PowerSupplyType), pst))
|
|||
|
|
End If
|
|||
|
|
' Throw New NotImplementedException()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Overrides Function GetFormParameter(pst As PowerSupplyType, Partype As Integer) As Object
|
|||
|
|
Throw New NotImplementedException()
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Class
|