We use the following scenario for running long processes and
displaying a UI.
Interface for all long processes (the code that does the process):
Public Interface ILongProcess
Event Progress(ByVal sender As Object, ByVal e As
ProgressEventArgs)
Event Completed(ByVal sender As Object, ByVal e As EventArgs)
Sub Start(ByVal state As Object)
Sub Cancel()
ReadOnly Property IsCancelled() As Boolean
ReadOnly Property IsCompleted() As Boolean
ReadOnly Property Title() As String
ReadOnly Property AnimationSource() As AnimationType
ReadOnly Property ResourceName() As String
ReadOnly Property ShowProgressBar() As Boolean
End Interface
And then we have the form which displays the progress bar, animation,
and has a cancel button.
Class LongProcessForm
Inherits Form
Public Sub New(process As ILongProcess)
...
End Sub
End Class
And then we have a bunch of processes..
Class CopyProcess Implements ILongProcess
Class DeleteProcess Implements ILongProcess
etc..
so the long processes can all take advantage of the single UI form to
display their UI and provide animation, progress bar, and cancel
functionality.
HTH,
Sam
Could anyone please give me an example of a realistic use of polymorphism.
B-Line is now hiring one VB.NET developer for
WinForms + WebServices position with ASPX in future.
Seaking mid to senior level developer. For
information or to apply e-mail sam_blinex_com.