blob: ca0605ee408f77b7a97a715a37312e0ebdf5eb29 (
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace macdoc
{
public partial class AppleDocWizard : MonoMac.AppKit.NSWindow
{
ProcessStage currentStage = ProcessStage.Initializing;
public AppleDocWizard (IntPtr handle) : base (handle)
{
}
[Export ("initWithCoder:")]
public AppleDocWizard (NSCoder coder) : base (coder)
{
}
public void PostInitialize ()
{
}
public CancellationTokenSource CancellationSource {
get;
set;
}
public void UpdateProgress (AppleDocEventArgs e)
{
switch (e.Stage) {
case ProcessStage.GettingManifest:
currentStage = ProcessStage.GettingManifest;
progressIndicator.Indeterminate = true;
progressIndicator.StartAnimation (this);
stageLabel.StringValue = "Getting Apple Documentation feed";
extraStageInfoLabel.Hidden = true;
break;
case ProcessStage.Downloading:
if (currentStage == ProcessStage.Downloading) {
progressIndicator.DoubleValue = e.Percentage;
extraStageInfoLabel.StringValue = e.Percentage + " %";
} else {
currentStage = ProcessStage.Downloading;
progressIndicator.Indeterminate = false;
progressIndicator.StartAnimation (this);
stageLabel.StringValue = "Downloading Apple documentation";
extraStageInfoLabel.Hidden = false;
}
break;
case ProcessStage.Extracting:
if (currentStage == ProcessStage.Extracting)
extraStageInfoLabel.StringValue = e.CurrentFile ?? "(none)";
else {
currentStage = ProcessStage.Extracting;
progressIndicator.Indeterminate = true;
progressIndicator.StartAnimation (this);
stageLabel.StringValue = "Extracting Apple documentation";
extraStageInfoLabel.Hidden = false;
extraStageInfoLabel.StringValue = string.Empty;
}
break;
case ProcessStage.Merging:
if (currentStage == ProcessStage.Merging)
extraStageInfoLabel.StringValue = e.CurrentFile;
else {
currentStage = ProcessStage.Merging;
stageLabel.StringValue = "Merging MonoTouch documentation with Apple documentation";
progressIndicator.Indeterminate = true;
progressIndicator.StartAnimation (this);
extraStageInfoLabel.Hidden = false;
extraStageInfoLabel.StringValue = "Preparing merge";
}
break;
case ProcessStage.Finished:
currentStage = ProcessStage.Finished;
progressIndicator.StopAnimation (this);
break;
default:
break;
}
}
partial void CancelClicked (MonoMac.AppKit.NSButton sender)
{
CancellationSource.Cancel ();
}
}
}
|