-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathOverallProgress.cs
More file actions
76 lines (58 loc) · 2.11 KB
/
OverallProgress.cs
File metadata and controls
76 lines (58 loc) · 2.11 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
68
69
70
71
72
73
74
75
76
using System;
namespace FFBitrateViewer
{
public class OverallProgress : Bindable
{
public bool IsActive { get { return Get<bool>(); } private set { Set(value); } }
private bool IsIndeterminate { get { return Get<bool>(); } set { Set(value); } }
public bool IsIndeterminateXAML { get { return IsIndeterminate && IsActive; } }
public int Current { get { return Get<int>(); } set { Set(value); /* PercentUpdate(); */ } }
public int Max { get { return Get<int>(); } set { Set(value); /* PercentUpdate(); */ } }
public double CurrentPercent { get { return Get<double>(); } private set { Set(value); } }
public string? Text { get { return Get<string?>(); } private set { Set(value); } }
public double ProcessedDuration { get { return Get<double>(); } set { Set(value); } }
public OverallProgress(bool indeterminate = false) {
IsIndeterminate = indeterminate;
Max = 100;
Current = 0;
ProcessedDuration = 0;
//IsActive = true;
//Text = "123";
}
public void Start()
{
IsActive = true;
}
public void Stop()
{
IsActive = false;
}
public void Show(string text)
{
Text = text;
IsIndeterminate = true;
Start();
}
public void Hide()
{
Text = null;
IsIndeterminate = false;
Stop();
}
public void Reset()
{
Current = 0;
ProcessedDuration = 0;
}
public void FileProgressSet(int fileIndex, Frame? frame = null)
{
string s = "Processing file: " + (fileIndex + 1);
if (frame != null)
{
s += ", time: " + TimeSpan.FromSeconds(frame.StartTime).ToString(@"hh\:mm\:ss");
Current = (int)(ProcessedDuration + frame.StartTime);
}
Text = s;
}
}
}