-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaitForm1.vb
57 lines (48 loc) · 1.95 KB
/
WaitForm1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
' Developer Express Code Central Example:
' How to cancel time-consuming operation from the WaitForm
'
' This example illustrates how to cancel a time-consuming operation on a WaitForm.
' To accomplish this task, place a BackgroundWorker and SplashScreenManager onto a
' Form, and add the Cancel button in the WaitForm's designer. The main idea is to
' perform data loading in a background thread, pass the ILocked object both to the
' WaitForm and to this thread, and check its condition while data is loading.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E4524
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports DevExpress.XtraWaitForm
Namespace WaitFormCanceling
Public Partial Class WaitForm1
Inherits WaitForm
Public Sub New()
InitializeComponent()
progressPanel1.AutoHeight = True
End Sub
Private locker As Object
#Region "Overrides"
Public Overrides Sub SetCaption(ByVal caption As String)
MyBase.SetCaption(caption)
progressPanel1.Caption = caption
End Sub
Public Overrides Sub SetDescription(ByVal description As String)
MyBase.SetDescription(description)
progressPanel1.Description = description
End Sub
Public Overrides Sub ProcessCommand(ByVal cmd As [Enum], ByVal arg As Object)
MyBase.ProcessCommand(cmd, arg)
Dim command As WaitFormCommand = CType(cmd, WaitFormCommand)
If command = WaitFormCommand.SendObject Then
locker = arg
End If
End Sub
#End Region
Public Enum WaitFormCommand
SendObject
End Enum
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
If locker IsNot Nothing Then CType(locker, ILocked).IsCanceled = True
End Sub
End Class
End Namespace