/
MyProgressIndicator.vb
60 lines (52 loc) · 1.8 KB
/
MyProgressIndicator.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
58
59
60
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports DevExpress.XtraEditors
Imports DevExpress.Services
Imports System.Windows.Forms
Imports DevExpress.Xpf.Editors
Imports System.Windows.Threading
Namespace DocumentVariablesExample
#Region "#myprogressindicator"
Friend Class MyProgressIndicatorService
Implements IProgressIndicationService
Private _Indicator As ProgressBarEdit
Public Property Indicator() As ProgressBarEdit
Get
Return _Indicator
End Get
Set(ByVal value As ProgressBarEdit)
_Indicator = value
End Set
End Property
Public Sub New(ByVal provider As IServiceProvider, ByVal indicator As ProgressBarEdit)
_Indicator = indicator
End Sub
#Region "IProgressIndicationService Members"
Private Sub Begin(ByVal displayName As String, ByVal minProgress As Integer, ByVal maxProgress As Integer, ByVal currentProgress As Integer) Implements IProgressIndicationService.Begin
_Indicator.Minimum = minProgress
_Indicator.Maximum = maxProgress
_Indicator.EditValue = currentProgress
_Indicator.Visibility = System.Windows.Visibility.Visible
Refresh()
End Sub
Private Sub [End]() Implements IProgressIndicationService.End
_Indicator.Visibility = System.Windows.Visibility.Collapsed
Refresh()
End Sub
Private Sub SetProgress(ByVal currentProgress As Integer) Implements IProgressIndicationService.SetProgress
_Indicator.EditValue = currentProgress
Refresh()
End Sub
#End Region
Private Sub Refresh()
Dim emptyDelegate As Action = Function() AnonymousMethod1()
_Indicator.Dispatcher.Invoke(DispatcherPriority.Render, emptyDelegate)
End Sub
Private Function AnonymousMethod1() As Boolean
Return True
End Function
End Class
#End Region ' #myprogressindicatorsindicator
End Namespace