-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainViewModel.cs
27 lines (24 loc) · 1.23 KB
/
MainViewModel.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
using System;
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.POCO;
namespace DXSampleNotificationSevice.ViewModel {
[POCOViewModel]
public class MainViewModel {
[ServiceProperty(Key = "ServiceWithDefaultNotifications")]
protected virtual INotificationService DefaultNotificationService { get { return null; } }
[ServiceProperty(Key = "ServiceWithCustomNotifications")]
protected virtual INotificationService CustomNotificationService { get { return null; } }
public void ShowDefaultNotification() {
INotification notification = DefaultNotificationService.CreatePredefinedNotification("Predefined Notification", "First line", String.Format("Second line. Time: {0}", DateTime.Now), null);
notification.ShowAsync();
}
public void ShowCustomNotification() {
CustomNotificationViewModel vm = ViewModelSource.Create(() => new CustomNotificationViewModel());
vm.Caption = "Custom Notification";
vm.Content = String.Format("Time: {0}", DateTime.Now);
INotification notification = CustomNotificationService.CreateCustomNotification(vm);
notification.ShowAsync();
}
}
}