aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
blob: 96de08447736795c16022b496b4c1a7b7a5c2dd6 (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
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Tango.Core.Commands;
using Tango.SharedUI;
using Tango.Touch.Controls;

namespace Tango.PPC.Common.Notifications
{
    /// <summary>
    /// Represents the PPC user notification provider responsible for displaying information, alerts and dialogs to the user.
    /// </summary>
    public interface INotificationProvider
    {
        /// <summary>
        /// Gets the collection of notification items.
        /// </summary>
        ObservableCollection<NotificationItem> NotificationItems { 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 dialog.
        /// </summary>
        FrameworkElement CurrentDialog { 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 question message box.
        /// </summary>
        /// <param name="message">The message.</param>
        Task<bool> ShowQuestion(String message);

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

        /// <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>
        /// Inserts the notification item to the bottom of the notifications collection.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="condition">A condition which determines if this item is still relevant.</param>
        /// <param name="autoCheck">Determines whether to perform automatic checking of the condition.</param>
        /// <param name="checkInterval">Determines how frequently the condition function will be invoked. (Default 1 second)</param>
        NotificationItem PushNotification(NotificationItem item, Func<bool> condition, bool autoCheck = true, TimeSpan? checkInterval = null);

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

        /// <summary>
        /// Invokes the notification items conditions.
        /// </summary>
        void InvokeNotificationItemsConditions();

        /// <summary>
        /// Gets the pop notification command.
        /// </summary>
        RelayCommand<NotificationItem> PopNotificationCommand { get; }
    }
}