~ubuntu-branches/ubuntu/trusty/mono-addins/trusty-proposed

« back to all changes in this revision

Viewing changes to Mono.Addins/Mono.Addins/ConsoleProgressStatus.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-04-25 11:11:33 UTC
  • mfrom: (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110425111133-t05u5p7o5fxx70fu
Tags: 0.6-2
Upload to Unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
namespace Mono.Addins
33
33
{
 
34
        /// <summary>
 
35
        /// An IProgressStatus class which writes output to the console.
 
36
        /// </summary>
34
37
        public class ConsoleProgressStatus: MarshalByRefObject, IProgressStatus
35
38
        {
36
39
                bool canceled;
37
40
                int logLevel;
38
41
                
 
42
                /// <summary>
 
43
                /// Initializes a new instance
 
44
                /// </summary>
 
45
                /// <param name="verboseLog">
 
46
                /// Set to true to enabled verbose log
 
47
                /// </param>
39
48
                public ConsoleProgressStatus (bool verboseLog)
40
49
                {
41
50
                        if (verboseLog)
44
53
                                logLevel = 1;
45
54
                }
46
55
                
 
56
                /// <summary>
 
57
                /// Initializes a new instance
 
58
                /// </summary>
 
59
                /// <param name="logLevel">
 
60
                /// Verbosity level. 0: not verbose, 1: normal, >1 extra verbose
 
61
                /// </param>
47
62
                public ConsoleProgressStatus (int logLevel)
48
63
                {
49
64
                        this.logLevel = logLevel;
50
65
                }
51
66
                
 
67
                /// <summary>
 
68
                /// Sets the description of the current operation.
 
69
                /// </summary>
 
70
                /// <param name="msg">
 
71
                /// A message
 
72
                /// </param>
 
73
                /// <remarks>
 
74
                /// This method is called by the add-in engine to show a description of the operation being monitorized.
 
75
                /// </remarks>
52
76
                public void SetMessage (string msg)
53
77
                {
54
78
                }
55
79
                
 
80
                /// <summary>
 
81
                /// Sets the progress of the operation.
 
82
                /// </summary>
 
83
                /// <param name="progress">
 
84
                /// A number between 0 and 1. 0 means no progress, 1 means operation completed.
 
85
                /// </param>
 
86
                /// <remarks>
 
87
                /// This method is called by the add-in engine to show the progress of the operation being monitorized.
 
88
                /// </remarks>
56
89
                public void SetProgress (double progress)
57
90
                {
58
91
                }
59
92
                
 
93
                /// <summary>
 
94
                /// Writes text to the log.
 
95
                /// </summary>
 
96
                /// <param name="msg">
 
97
                /// Message to write
 
98
                /// </param>
60
99
                public void Log (string msg)
61
100
                {
62
101
                        Console.WriteLine (msg);
63
102
                }
64
103
                
 
104
                /// <summary>
 
105
                /// Reports a warning.
 
106
                /// </summary>
 
107
                /// <param name="message">
 
108
                /// Warning message
 
109
                /// </param>
 
110
                /// <remarks>
 
111
                /// This method is called by the add-in engine to report a warning in the operation being monitorized.
 
112
                /// </remarks>
65
113
                public void ReportWarning (string message)
66
114
                {
67
115
                        if (logLevel > 0)
68
116
                                Console.WriteLine ("WARNING: " + message);
69
117
                }
70
118
                
 
119
                /// <summary>
 
120
                /// Reports an error.
 
121
                /// </summary>
 
122
                /// <param name="message">
 
123
                /// Error message
 
124
                /// </param>
 
125
                /// <param name="exception">
 
126
                /// Exception that caused the error. It can be null.
 
127
                /// </param>
 
128
                /// <remarks>
 
129
                /// This method is called by the add-in engine to report an error occurred while executing the operation being monitorized.
 
130
                /// </remarks>
71
131
                public void ReportError (string message, Exception exception)
72
132
                {
73
133
                        if (logLevel == 0)
90
150
                        }
91
151
                }
92
152
                
 
153
                /// <summary>
 
154
                /// Returns True when the user requested to cancel this operation
 
155
                /// </summary>
93
156
                public bool IsCanceled {
94
157
                        get { return canceled; }
95
158
                }
96
159
                
 
160
                /// <summary>
 
161
                /// Log level requested by the user: 0: no log, 1: normal log, >1 verbose log
 
162
                /// </summary>
97
163
                public int LogLevel {
98
164
                        get { return logLevel; }
99
165
                }
100
166
                
 
167
                /// <summary>
 
168
                /// Cancels the operation being montorized.
 
169
                /// </summary>
101
170
                public void Cancel ()
102
171
                {
103
172
                        canceled = true;