-
Notifications
You must be signed in to change notification settings - Fork 0
/
FeedbackInfo.cs
201 lines (190 loc) · 4.86 KB
/
FeedbackInfo.cs
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDeCoder.Coding
{
/// <summary>
/// An FeedbackInfo object which contains data for the user.
/// </summary>
public interface IFeedbackInfo
{
/// <summary>
/// The level of the feedback.
/// It changes the behaviour of your message.
/// </summary>
FeedbackInfoLevel Level { get; set; }
/// <summary>
/// True if the decoded string should be applied, otherwise false.
/// </summary>
bool Apply { get; set; }
/// <summary>
/// True if the selection shouldn't be recognized, otherwise false.
/// You know when you should set this to true, if you do not, the let it be false.
/// </summary>
bool ExpelSelection { get; set; }
/// <summary>
/// The message displayed to the user.
/// </summary>
string Message { get; set; }
}
/// <summary>
/// The level of feedback.
/// </summary>
public enum FeedbackInfoLevel
{
/// <summary>
/// Just a normal info. Displayed in green next to the apply button.
/// </summary>
Info,
/// <summary>
/// A warning displayed in orange next to the apply button.
/// </summary>
Warning,
/// <summary>
/// An error displayed in red next to the apply button.
/// If it was a feedback for a non-preview process, the the message
/// will be shown on an overlay!
/// </summary>
Error
}
/// <summary>
/// An implementation of the IFeedbackInfo interface.
/// It stops the apply process and is on error-level.
/// </summary>
public class FeedbackInfo_Error : IFeedbackInfo
{
public FeedbackInfoLevel Level
{
set { }
get
{
return FeedbackInfoLevel.Error;
}
}
public bool Apply
{
set { }
get
{
return false;
}
}
private bool _expelSelection;
public bool ExpelSelection
{
set { }
get
{
return _expelSelection;
}
}
private string _message;
public string Message
{
set { }
get
{
return _message;
}
}
public FeedbackInfo_Error(string MessageArg, bool ExpelSelectionArg = false)
{
this._message = MessageArg;
this._expelSelection = ExpelSelectionArg;
}
}
/// <summary>
/// An implementation of the IFeedbackInfo interface.
/// The decoded string will be applied. Message on warning-level.
/// </summary>
public class FeedbackInfo_Warning : IFeedbackInfo
{
public FeedbackInfoLevel Level
{
set { }
get
{
return FeedbackInfoLevel.Warning;
}
}
public bool Apply
{
set { }
get
{
return true;
}
}
private bool _expelSelection;
public bool ExpelSelection
{
set { }
get
{
return _expelSelection;
}
}
private string _message;
public string Message
{
set { }
get
{
return _message;
}
}
public FeedbackInfo_Warning(string Message, bool ExpelSelectionArg = false)
{
this._message = Message;
this._expelSelection = ExpelSelectionArg;
}
}
/// <summary>
/// An implementation of the IFeedbackInfo interface.
/// The decoded string will be applied. Message on info-level.
/// </summary>
public class FeedbackInfo_Info : IFeedbackInfo
{
public FeedbackInfoLevel Level
{
set { }
get
{
return FeedbackInfoLevel.Info;
}
}
public bool Apply
{
set { }
get
{
return true;
}
}
private bool _expelSelection;
public bool ExpelSelection
{
set { }
get
{
return _expelSelection;
}
}
private string _message;
public string Message
{
set { }
get
{
return _message;
}
}
public FeedbackInfo_Info(string Message, bool ExpelSelectionArg = false)
{
this._message = Message;
this._expelSelection = ExpelSelectionArg;
}
}
}