@@ -5,7 +5,6 @@ namespace Skyline.DataMiner.Sdk
5
5
using System . Collections . Generic ;
6
6
using System . Diagnostics ;
7
7
using System . Linq ;
8
- using System . Threading ;
9
8
10
9
using Microsoft . Build . Framework ;
11
10
@@ -21,7 +20,7 @@ namespace Skyline.DataMiner.Sdk
21
20
22
21
public class DmappCreation : Task , ICancelableTask
23
22
{
24
- private CancellationTokenSource _cancellationTokenSource ;
23
+ private bool cancel = false ;
25
24
26
25
public string ProjectFile { get ; set ; }
27
26
public string ProjectType { get ; set ; }
@@ -31,7 +30,6 @@ public class DmappCreation : Task, ICancelableTask
31
30
32
31
public override bool Execute ( )
33
32
{
34
- _cancellationTokenSource = new CancellationTokenSource ( ) ;
35
33
Stopwatch timer = Stopwatch . StartNew ( ) ;
36
34
37
35
try
@@ -45,7 +43,7 @@ public override bool Execute()
45
43
return false ;
46
44
}
47
45
48
- if ( _cancellationTokenSource . IsCancellationRequested )
46
+ if ( cancel )
49
47
{
50
48
// Early cancel if necessary
51
49
return true ;
@@ -57,7 +55,7 @@ public override bool Execute()
57
55
case DataMinerProjectType . AutomationScriptLibrary :
58
56
case DataMinerProjectType . UserDefinedApi :
59
57
case DataMinerProjectType . AdHocDataSource : // Could change in the future as this is automation script style, but doesn't behave as an automation script.
60
- AutomationScriptStyle . PackageResult automationScriptResult = AutomationScriptStyle . TryCreatePackage ( preparedData ) . WaitAndUnwrapException ( _cancellationTokenSource . Token ) ;
58
+ AutomationScriptStyle . PackageResult automationScriptResult = AutomationScriptStyle . TryCreatePackage ( preparedData ) . WaitAndUnwrapException ( ) ;
61
59
62
60
if ( ! automationScriptResult . IsSuccess )
63
61
{
@@ -82,7 +80,7 @@ public override bool Execute()
82
80
return false ;
83
81
}
84
82
85
- if ( _cancellationTokenSource . IsCancellationRequested )
83
+ if ( cancel )
86
84
{
87
85
return false ;
88
86
}
@@ -116,7 +114,7 @@ private bool TryCreateAppPackageBuilder(PackageCreationData preparedData, DataMi
116
114
}
117
115
118
116
// Create custom install script.
119
- AutomationScriptStyle . PackageResult packageResult = AutomationScriptStyle . TryCreatePackage ( preparedData , createAsTempFile : true ) . WaitAndUnwrapException ( _cancellationTokenSource . Token ) ;
117
+ AutomationScriptStyle . PackageResult packageResult = AutomationScriptStyle . TryCreatePackage ( preparedData , createAsTempFile : true ) . WaitAndUnwrapException ( ) ;
120
118
121
119
if ( ! packageResult . IsSuccess )
122
120
{
@@ -135,7 +133,7 @@ private bool TryCreateAppPackageBuilder(PackageCreationData preparedData, DataMi
135
133
/// </summary>
136
134
public void Cancel ( )
137
135
{
138
- _cancellationTokenSource . Cancel ( ) ;
136
+ cancel = true ;
139
137
}
140
138
141
139
/// <summary>
0 commit comments