blob: 59c2cdc4020796aec74dca62ed760ff88d8748af (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Tango.AzureUtils.UI.Managers
{
public class DefaultStatusManager : IStatusManager
{
public event EventHandler<AzureUtilsProgressEventArgs> StatusUpdated;
public void UpdateStatus(AzureUtilsStage stage, string message, bool isIndeterminate = false)
{
UpdateStatus(new AzureUtilsProgressEventArgs()
{
IsIndeterminate = isIndeterminate,
Message = message,
Stage = stage,
Maximum = 100,
Progress = 0
});
}
public void UpdateStatus(AzureUtilsProgressEventArgs progress)
{
if (progress.IsIndeterminate || (progress.Maximum == 0 && progress.Progress == 0))
{
Mouse.OverrideCursor = Cursors.Wait;
}
else
{
Mouse.OverrideCursor = null;
}
StatusUpdated?.Invoke(this, progress);
}
public void UpdateStatus(Exception ex)
{
UpdateStatus(AzureUtilsStage.Error, ex.Message, false);
}
}
}
|