aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs
blob: 0275550222223566b3123c71c998b371abf79c8b (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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Tango.Core.Commands;
using Tango.SharedUI;

namespace Tango.FSE.Common.Notifications
{
    /// <summary>
    /// Represents the PPC user notification provider responsible for displaying information, alerts and dialogs to the user.
    /// </summary>
    public interface INotificationProvider : INotifyApplicationReady
    {
        /// <summary>
        /// Gets the collection of notification items.
        /// </summary>
        ObservableCollection<NotificationItem> NotificationItems { get; }

        /// <summary>
        /// Gets the collection of snack bar items.
        /// </summary>
        ObservableCollection<SnackbarItem> SnackbarItems { get; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance has snack bar items.
        /// </summary>
        bool HasSnackbarItems { get; }

        /// <summary>
        /// Gets or sets a value indicating whether to delay the snackbar items closing timeout.
        /// </summary>
        bool HoldSnackbarItemsTimeout { get; set; }

        /// <summary>
        /// Gets the notification items view.
        /// </summary>
        ICollectionView NotificationItemsView { get; }

        /// <summary>
        /// Gets the collection of task items.
        /// </summary>
        ObservableCollection<TaskItem> TaskItems { get; }

        /// <summary>
        /// Gets a value indicating whether there are any task items pending.
        /// </summary>
        bool HasTaskItems { get; }

        /// <summary>
        /// Gets the current application bar item.
        /// </summary>
        AppBarItem CurrentAppBarItem { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has application bar item.
        /// </summary>
        bool HasAppBarItem { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has notification items.
        /// </summary>
        bool HasNotificationItems { get; }

        /// <summary>
        /// Gets the current message box.
        /// </summary>
        MessageBoxVM CurrentMessageBox { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has message box.
        /// </summary>
        bool HasMessageBox { get; }

        /// <summary>
        /// Gets the current input box.
        /// </summary>
        InputBoxVM CurrentInputBox { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has input box.
        /// </summary>
        bool HasInputBox { get; }

        /// <summary>
        /// Gets the current dialog.
        /// </summary>
        FrameworkElement CurrentDialog { get; }

        /// <summary>
        /// Gets the current app button.
        /// </summary>
        AppButton CurrentAppButton { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has a dialog.
        /// </summary>
        bool HasDialog { get; }

        /// <summary>
        /// Shows an information message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task ShowInfo(String message);

        /// <summary>
        /// Shows warning message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task ShowWarning(String message);

        /// <summary>
        /// Shows an error message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task ShowError(String message);

        /// <summary>
        /// Shows a success message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task ShowSuccess(String message);

        /// <summary>
        /// Shows an input box.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="message">The message.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="defaultInput">The default input.</param>
        /// <param name="inputHint">The input hint.</param>
        /// <param name="okText">The ok text.</param>
        /// <param name="cancelText">The cancel text.</param>
        /// <returns></returns>
        Task<InputBoxResult> ShowInputBox(String title, String message, PackIconKind icon = PackIconKind.InfoOutline, String defaultInput = null, String inputHint = null, int? maxChars = null, String okText = null, String cancelText = null, Func<String, String> validationFunc = null);

        /// <summary>
        /// Shows a question message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task<bool> ShowQuestion(String message, String okText = null, String cancelText = null);

        /// <summary>
        /// Shows a warning question message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task<bool> ShowWarningQuestion(String message, String okText = null, String cancelText = null);

        /// <summary>
        /// Inserts the notification item to the bottom of the notifications collection.
        /// </summary>
        /// <param name="item">The item.</param>
        NotificationItem PushNotification(NotificationItem item);

        /// <summary>
        /// Pushes the notification.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        NotificationItem PushNotification<T>() where T : NotificationItem;

        /// <summary>
        /// Displays the specified dialog in a modal design.
        /// </summary>
        /// <typeparam name="VM"></typeparam>
        /// <param name="datacontext">The data context.</param>
        /// <param name="view">The view.</param>
        /// <returns></returns>
        Task<VM> ShowDialog<VM>(VM datacontext, FrameworkElement view) where VM : DialogViewVM;

        /// <summary>
        /// Displays the specified dialog in a modal design.
        /// The notification provider will try to locate the view automatically using conventions.
        /// </summary>
        /// <typeparam name="VM"></typeparam>
        /// <param name="datacontext">The data context.</param>
        /// <returns></returns>        
        Task<VM> ShowDialog<VM>(VM datacontext) where VM : DialogViewVM;

        /// <summary>
        /// Displays the specified dialog in a modal design.
        /// The data context instance will be automatically created.
        /// The notification provider will try to locate the view automatically using conventions.
        /// </summary>
        /// <typeparam name="VM"></typeparam>
        /// <returns></returns>
        Task<VM> ShowDialog<VM>() where VM : DialogViewVM;

        /// <summary>
        /// Removed the specified notification item.
        /// </summary>
        /// <param name="item">The item.</param>
        void PopNotification(NotificationItem item);

        /// <summary>
        /// Gets a value indicating whether this instance is in global busy state.
        /// </summary>
        bool IsInGlobalBusyState { get; }

        /// <summary>
        /// Sets the global busy message.
        /// </summary>
        /// <param name="message">The message.</param>
        void SetGlobalBusyMessage(String message);

        /// <summary>
        /// Releases the global busy message.
        /// </summary>
        void ReleaseGlobalBusyMessage();

        /// <summary>
        /// Gets the current global busy message.
        /// </summary>
        String GlobalBusyMessage { get; }

        /// <summary>
        /// Pushes the application bar item.
        /// </summary>
        /// <param name="appBarItem">The application bar item.</param>
        /// <returns></returns>
        AppBarItem PushAppBarItem(AppBarItem appBarItem);

        /// <summary>
        /// Pushes the application bar item.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        AppBarItem PushAppBarItem<T>() where T : AppBarItem;

        /// <summary>
        /// Pops the application bar item.
        /// </summary>
        /// <param name="appBarItem">The application bar item.</param>
        void PopAppBarItem(AppBarItem appBarItem);

        /// <summary>
        /// Pushes the task item.
        /// </summary>
        /// <param name="taskBarItem">The task bar item.</param>
        /// <returns></returns>
        TaskItem PushTaskItem(TaskItem taskBarItem);

        /// <summary>
        /// Pushes the task item.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        TaskItem PushTaskItem<T>() where T : TaskItem;

        /// <summary>
        /// Pushes the task item with the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="canCancel">Indicates whether the cancel button will be enabled.</param>
        /// <param name="cancelAction">Specify the action to execute when cancel button is pressed.</param>
        /// <returns></returns>
        TaskItem PushTaskItem(String message, bool canCancel = false, Action cancelAction = null);

        /// <summary>
        /// Pops the task item.
        /// </summary>
        /// <param name="TaskBarItem">The task bar item.</param>
        void PopTaskItem(TaskItem taskBarItem);

        /// <summary>
        /// Pushes the snack bar item.
        /// </summary>
        /// <param name="snackbarItem">The snack bar item.</param>
        /// <returns></returns>
        SnackbarItem PushSnackbarItem(SnackbarItem snackbarItem);

        /// <summary>
        /// Pushes the snack bar item.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="title">The title.</param>
        /// <param name="canClose">if set to <c>true</c> [can close].</param>
        /// <param name="message">The message.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="closeAction">The close action.</param>
        /// <param name="pressAction">The press action.</param>
        /// <returns></returns>
        SnackbarItem PushSnackbarItem(MessageType type, String title, bool canClose, String message = null, TimeSpan? timeout = null, Action closeAction = null, Action pressAction = null);

        /// <summary>
        /// Display a new error SnackBar. Pressing the snack bar will display the issue reporting dialog.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="title">The title.</param>
        /// <param name="message">The message.</param>
        /// <param name="messageType">The message type.</param>
        /// <returns></returns>
        SnackbarItem PushErrorReportingSnackbar(Exception exception, String title, String message, MessageType messageType = MessageType.BugReport);

        /// <summary>
        /// Displays a indeterminate progress Snackbar. Should use <see cref="SnackbarItem.ProgressCompleted(string, TimeSpan?)"/> and <see cref="SnackbarItem.ProgressFailed(string, TimeSpan?)"/>.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        SnackbarItem PushProgressSnackbar(String title, String message);

        /// <summary>
        /// Pops the snack bar item.
        /// </summary>
        /// <param name="snackbarItem">The snack bar item.</param>
        void PopSnackbarItem(SnackbarItem snackbarItem);

        /// <summary>
        /// Gets or sets a value indicating whether to allow notifications visibility.
        /// </summary>
        bool NotificationsVisible { get; set; }

        /// <summary>
        /// Pushes the app button.
        /// </summary>
        /// <param name="appButton">The app button.</param>
        void PushAppButton(AppButton appButton);

        /// <summary>
        /// Pops the app button.
        /// </summary>
        /// <param name="appButton">The app button.</param>
        void PopAppButton(AppButton appButton);
    }
}