Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 620dfb3

Browse files
DevExpressExampleBotDevExpressExampleBot
DevExpressExampleBot
authored and
DevExpressExampleBot
committed
Source auto update [skip ci]
1 parent 702ac20 commit 620dfb3

File tree

12 files changed

+280
-304
lines changed

12 files changed

+280
-304
lines changed

‎VB/WorkbookProgressSample.sln‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
23
# Visual Studio Version 16
34
VisualStudioVersion = 16.0.31005.135
45
MinimumVisualStudioVersion = 10.0.40219.1

‎VB/WorkbookProgressSample/Form1.Designer.vb‎

Lines changed: 110 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎VB/WorkbookProgressSample/Form1.vb‎

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
1-
Imports System
1+
Imports System
22
Imports System.Threading
33
Imports System.Windows.Forms
44
Imports DevExpress.Spreadsheet
55

66
Namespace WorkbookProgressSample
7-
Partial Public Class Form1
8-
Inherits Form
97

10-
Private cancellationSource As CancellationTokenSource
8+
Public Partial Class Form1
9+
Inherits Form
1110

12-
Public Sub New()
13-
InitializeComponent()
14-
End Sub
11+
Private cancellationSource As CancellationTokenSource
1512

16-
Private Async Sub RunCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRunCancel.Click
17-
If Not Me.btnRunCancel.IsHandleCreated Then Return
13+
Public Sub New()
14+
InitializeComponent()
15+
End Sub
1816

19-
If cancellationSource IsNot Nothing Then
20-
cancellationSource.Cancel()
21-
Else
22-
progressBarLoad.Value = 0
23-
progressBarExport.Value = 0
24-
btnRunCancel.Text = "Cancel"
25-
cancellationSource = New CancellationTokenSource()
26-
Try
27-
Using workbook As New Workbook()
28-
Await workbook.LoadDocumentAsync("Document.xlsx", cancellationSource.Token, New Progress(Of Integer)(Sub(progress)
29-
progressBarLoad.Value = progress
30-
progressBarLoad.Refresh()
31-
End Sub))
32-
Await workbook.ExportToPdfAsync("Result.pdf", cancellationSource.Token, New Progress(Of Integer)(Sub(progress)
33-
progressBarExport.Value = progress
34-
progressBarExport.Refresh()
35-
End Sub))
36-
End Using
37-
Catch e1 As OperationCanceledException
38-
progressBarLoad.Value = 0
39-
progressBarExport.Value = 0
40-
Finally
41-
cancellationSource.Dispose()
42-
cancellationSource = Nothing
43-
btnRunCancel.Text = "Run"
44-
End Try
45-
End If
46-
End Sub
17+
Private Async Sub RunCancel_Click(ByVal sender As Object, ByVal e As EventArgs)
18+
If cancellationSource IsNot Nothing Then
19+
cancellationSource.Cancel()
20+
Else
21+
progressBarLoad.Value = 0
22+
progressBarExport.Value = 0
23+
btnRunCancel.Text = "Cancel"
24+
cancellationSource = New CancellationTokenSource()
25+
Try
26+
Using workbook As Workbook = New Workbook()
27+
Await workbook.LoadDocumentAsync("Document.xlsx", cancellationSource.Token, New Progress(Of Integer)(Sub(progress)
28+
progressBarLoad.Value = progress
29+
progressBarLoad.Refresh()
30+
End Sub))
31+
Await workbook.ExportToPdfAsync("Result.pdf", cancellationSource.Token, New Progress(Of Integer)(Sub(progress)
32+
progressBarExport.Value = progress
33+
progressBarExport.Refresh()
34+
End Sub))
35+
End Using
36+
Catch __unusedOperationCanceledException1__ As OperationCanceledException
37+
progressBarLoad.Value = 0
38+
progressBarExport.Value = 0
39+
Finally
40+
cancellationSource.Dispose()
41+
cancellationSource = Nothing
42+
btnRunCancel.Text = "Run"
43+
End Try
44+
End If
45+
End Sub
4746

48-
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)HandlesMe.FormClosing
49-
cancellationSource?.Cancel()
50-
End Sub
51-
End Class
47+
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
48+
cancellationSource?.Cancel()
49+
End Sub
50+
End Class
5251
End Namespace

‎VB/WorkbookProgressSample/My Project/Resources.Designer.vb‎

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /