blob: 712c6507b98b9b7f4a56a884479069fc8f7b1394 (
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
46
47
48
49
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Tango.Core;
namespace Tango.AzureUtils.UI.Managers
{
public class DefaultStatusManager : ExtendedObject, 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)
{
InvokeUI(() =>
{
if (progress.IsIndeterminate || (progress.Progress > 0 && progress.Progress != progress.Maximum))
{
Mouse.OverrideCursor = Cursors.Wait;
}
else
{
Mouse.OverrideCursor = null;
}
StatusUpdated?.Invoke(this, progress);
});
}
public void UpdateStatus(Exception ex)
{
UpdateStatus(AzureUtilsStage.Error, ex.Message, false);
}
}
}
|