forked from MapStudioProject/MapStudio.UI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressHandler.cs
More file actions
67 lines (57 loc) · 1.74 KB
/
Copy pathProgressHandler.cs
File metadata and controls
67 lines (57 loc) · 1.74 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MapStudio.UI
{
/// <summary>
/// Keeps track of the progress of an operation.
/// </summary>
public class ProcessLoading
{
/// <summary>
/// The current instance of the progress loader.
/// </summary>
public static ProcessLoading Instance = null;
/// <summary>
/// Checks if the progress is currently active.
/// </summary>
public bool IsLoading;
/// <summary>
/// The current amount of progress being set.
/// </summary>
public int ProcessAmount;
/// <summary>
/// The total amount of progress to target to.
/// </summary>
public int ProcessTotal;
/// <summary>
/// The process name to display.
/// </summary>
public string ProcessName;
/// <summary>
/// An event that updates when the progress has been altered.
/// </summary>
public EventHandler OnUpdated;
public string Title = "";
public ProcessLoading() {
Instance = this;
}
public void UpdateIncrease(int amount, string process, string title = "Loading")
{
ProcessAmount += amount;
ProcessName = process;
OnUpdated?.Invoke(this, EventArgs.Empty);
Title = title;
}
public void Update(int amount, int total, string process, string title = "Loading")
{
ProcessAmount = amount;
ProcessTotal = total;
ProcessName = process;
OnUpdated?.Invoke(this, EventArgs.Empty);
Title = title;
}
}
}