@@ -283,7 +283,7 @@ private ResourceManagerRestRestClient GetResourcesClient()
283
283
/// <param name="result">The operation result</param>
284
284
private void UpdateProgress ( TrackingOperationResult result )
285
285
{
286
- this . ProgressTrackerObject . UpdateProgress ( result ) ;
286
+ this . ProgressTrackerObject . UpdateProgress ( result , this . IsResourceCreateOrUpdate ) ;
287
287
}
288
288
289
289
/// <summary>
@@ -332,26 +332,43 @@ internal ProgressTracker(string activityName, Func<ResourceManagerRestRestClient
332
332
this . ProgressRecord = new ProgressRecord ( activityId : 0 , activity : activityName , statusDescription : "Starting - 0.00% completed." ) ;
333
333
}
334
334
335
+ internal void SetProgressPercentageAndWriteProgress ( double percentage )
336
+ {
337
+ this . SetProgressRecordPercentComplete ( percentage ) ;
338
+ this . WriteProgressAction ( this . ProgressRecord ) ;
339
+ }
340
+
335
341
/// <summary>
336
342
/// Logs the fact that the operation has progressed.
337
343
/// </summary>
338
344
/// <param name="result">The operation result</param>
339
- internal void UpdateProgress ( TrackingOperationResult result )
345
+ /// <param name="isResourceCreateOrUpdate">Is Create or Update operation, other option include Move etc.</param>
346
+ internal void UpdateProgress ( TrackingOperationResult result , bool isResourceCreateOrUpdate )
340
347
{
341
- var currentState = this . GetOperationState ( result . OperationResult ) ;
342
-
343
- if ( result . Failed || currentState == null || ! this . LastState . EqualsInsensitively ( currentState ) )
348
+ if ( isResourceCreateOrUpdate )
344
349
{
345
- this . SetProgressRecordPercentComplete ( 100.0 ) ;
346
- this . WriteProgressAction ( this . ProgressRecord ) ;
347
- }
350
+ var currentState = this . GetOperationState ( result . OperationResult ) ;
348
351
349
- if ( currentState == null )
352
+ if ( result . Failed || currentState == null || ! this . LastState . EqualsInsensitively ( currentState ) )
353
+ {
354
+ this . SetProgressPercentageAndWriteProgress ( 100.0 ) ;
355
+ }
356
+
357
+ if ( currentState == null )
358
+ {
359
+ return ;
360
+ }
361
+
362
+ this . LastState = currentState ;
363
+ }
364
+ else
350
365
{
351
- return ;
366
+ if ( result . Failed )
367
+ {
368
+ this . SetProgressPercentageAndWriteProgress ( 100.0 ) ;
369
+ }
352
370
}
353
371
354
- this . LastState = currentState ;
355
372
this . SetProgressRecordPercentComplete ( result . OperationResult . PercentComplete ) ;
356
373
this . WriteProgressAction ( this . ProgressRecord ) ;
357
374
}
0 commit comments