Hi all,
I have classes setup similar to this:
<DataContract()> _
Public MustInherit Class SystemTaskProcessBase
Public MustOverride ReadOnly Property Name() As String
Public MustOverride ReadOnly Property Description() As String
Public MustOverride Property Result() As SystemTaskResult
<DataMember()> _
Private _TaskID As Integer = 0
Public Property TaskID() As Integer
Get
Return _TaskID
End Get
Set(ByVal value As Integer)
_TaskID = value
End Set
End Property
End Class
<DataContract()> _
Public Class RebootSystemTaskProcess
Inherits SystemTaskProcessBase
Private _Name As String = "Reboot System"
Public Overrides ReadOnly Property Name() As String
Get
Return _Name
End Get
End Property
Private _Description As String = "Task for the client to reboot itself internally."
Public Overrides ReadOnly Property Description() As String
Get
Return _Description
End Get
End Property
<DataMember()> _
Public _Result As SystemTaskResult = SystemTaskResult.NotProcessed
Public Overrides Property Result() As SystemTaskResult
Get
Return _Result
End Get
Set(ByVal value As SystemTaskResult)
_Result = value
End Set
End Property
End Class
<DataContract()> _
Public Class DeleteFileSystemTaskProcess
Inherits SystemTaskProcessBase
Private _Name As String = "Delete File"
Public Overrides ReadOnly Property Name() As String
Get
Return _Name
End Get
End Property
Private _Description As String = "Task for the client to delete a local file."
Public Overrides ReadOnly Property Description() As String
Get
Return _Description
End Get
End Property
<DataMember()> _
Public _Result As SystemTaskResult = SystemTaskResult.NotProcessed
Public Overrides Property Result() As SystemTaskResult
Get
Return _Result
End Get
Set(ByVal value As SystemTaskResult)
_Result = value
End Set
End Property
<DataMember()> _
Private _File As FileInfo
Public Property File() As FileInfo
Get
Return _File
End Get
Set(ByVal value As FileInfo)
_File = value
End Set
End Property
End Class
I need to use these classes on the client system, but also need to be able to create these "tasks" through a management interface. Each class (Task) that inherits the base, could have its own properties that are unique to each class, but at the same time, share the same common base class properties. For example, the above shows a reboot task and a delete file task, the delete file task needs to know which file to delete, so has a property for that. But the reboot task does not need this property. So when the management application is creating these tasks, it shouldn't provide a text box for the file property for the reboot task. There may be more tasks created at a later date with completely different properties.
How would I go about providing the WinForms management application a way to enumerate each class into a ListView for example, and allowing the user to create these tasks and filling in the dynamic properties that each class would have?
Desired functionality would be to create a task form that creates dynamic controls available for the properties as needed, depending on the public properties in each class, but at the same time have the base class properties available as well.
Any ideas are appreciated.
Thanks, Scott