~ubuntu-branches/ubuntu/lucid/monodevelop/lucid

1.2.3 by Jo Shields
Import upstream version 2.0+dfsg
1
// 
2
// SimpleProgressMonitor.cs
3
//  
4
// Author:
5
//       Lluis Sanchez Gual <lluis@novell.com>
6
// 
7
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
8
// 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
15
// 
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
18
// 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
// THE SOFTWARE.
26
27
using System;
28
29
namespace MonoDevelop.Core.ProgressMonitoring
30
{
31
	public class SimpleProgressMonitor: NullProgressMonitor
32
	{
33
		ProgressTracker tracker = new ProgressTracker ();
34
		
35
		protected ProgressTracker Tracker {
36
			get { return tracker; }
37
		}
38
		
39
		public SimpleProgressMonitor()
40
		{
41
		}
42
		
43
		public override void BeginTask (string name, int totalWork)
44
		{
45
			tracker.BeginTask (name, totalWork);
46
			OnProgressChanged ();
47
		}
48
		
49
		public override void BeginStepTask (string name, int totalWork, int stepSize)
50
		{
51
			tracker.BeginStepTask (name, totalWork, stepSize);
52
			OnProgressChanged ();
53
		}
54
		
55
		public override void EndTask ()
56
		{
57
			tracker.EndTask ();
58
			OnProgressChanged ();
59
		}
60
		
61
		public override void Step (int work)
62
		{
63
			tracker.Step (work);
64
			OnProgressChanged ();
65
		}
1.4.4 by Jo Shields
Import upstream version 2.2.1+dfsg
66
		
67
		protected override void OnCompleted ()
68
		{
69
			base.OnCompleted ();
70
			OnProgressChanged ();
71
		}
1.2.3 by Jo Shields
Import upstream version 2.0+dfsg
72
73
		protected virtual void OnProgressChanged ()
74
		{
75
		}
76
	}
77
}