-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaultRecordWindow.FastWorkflow.cs
More file actions
58 lines (46 loc) · 1.73 KB
/
Copy pathFaultRecordWindow.FastWorkflow.cs
File metadata and controls
58 lines (46 loc) · 1.73 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
using System.Windows.Threading;
namespace ArIED61850Tester;
public partial class FaultRecordWindow
{
private bool _initialFastWorkflowObserved;
/// <summary>
/// The Loaded handler starts discovery automatically. The first transient failure is
/// kept quiet while one bounded reconnect/rescan is attempted; only a final failure is
/// surfaced to the user. This also installs centered toast and safe re-download UX.
/// </summary>
protected override async void OnContentRendered(EventArgs e)
{
base.OnContentRendered(e);
InstallRedownloadUx();
if (_initialFastWorkflowObserved)
return;
_initialFastWorkflowObserved = true;
await Dispatcher.Yield(DispatcherPriority.ContextIdle);
while (IsBusy && IsVisible)
{
if (StatusText.StartsWith("Fault-record scan failed", StringComparison.OrdinalIgnoreCase))
HideStartupScanToast();
await Task.Delay(50).ConfigureAwait(true);
}
if (!IsVisible)
return;
if (Records.Count > 0)
{
HideStartupScanToast();
return;
}
if (!StatusText.StartsWith("Fault-record scan failed", StringComparison.OrdinalIgnoreCase))
return;
HideStartupScanToast();
StatusText = "Automatic file discovery is reconnecting and retrying once…";
await Task.Delay(250).ConfigureAwait(true);
if (!IsVisible || IsBusy)
return;
await ScanAsync().ConfigureAwait(true);
if (Records.Count > 0 ||
!StatusText.StartsWith("Fault-record scan failed", StringComparison.OrdinalIgnoreCase))
{
HideStartupScanToast();
}
}
}