-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShellViewModelBase.cs
47 lines (37 loc) · 1.39 KB
/
ShellViewModelBase.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
using Microsoft.Practices.Prism.Events;
using MvvmUtility.Infrastructure.Converters;
using MvvmUtility.Infrastructure.Eventing;
using MvvmUtility.Infrastructure.ViewUtility;
namespace MvvmUtility {
public abstract class ShellViewModelBase : WorkspaceViewModel {
protected ShellViewModelBase(IEventAggregator eventAggregator) : base(eventAggregator) {
Subscribe();
}
public abstract string Version { get; }
private void Subscribe() {
EventAggregator.GetEvent<StatusEvent>().Subscribe(
OnStatusEvent,
ThreadOption.UIThread,
true,
StatusEventPredicate
);
EventAggregator.GetEvent<BusyEvent>().Subscribe(
OnBusyEvent,
ThreadOption.UIThread,
true,
BusyEventPredicate
);
}
protected virtual bool BusyEventPredicate(BusyEventPayload obj) {
return true;
}
protected virtual void OnBusyEvent(BusyEventPayload obj) {
}
protected virtual void OnStatusEvent(StatusEventPayload obj) {
//MessageBox.Show(obj.Status);
}
protected virtual bool StatusEventPredicate(StatusEventPayload payload) {
return true;
}
}
}