-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainViewModel.cs
35 lines (31 loc) · 1.15 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
28
29
30
31
32
33
34
35
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;
using DXDocumentUIServiceSample.Common;
using System.Collections.ObjectModel;
using System.Linq;
namespace DXDocumentUIServiceSample.ViewModel {
public class MainViewModel : ViewModelBase {
IDocumentManagerService DocumentManagerService { get { return this.GetService<IDocumentManagerService>(); } }
public ObservableCollection<UserViewModel> Users {
get { return GetValue<ObservableCollection<UserViewModel>>(); }
set { SetValue(value); }
}
public MainViewModel() {
Users = DataHelper.GetUsers();
}
[Command]
public void DoubleClick(RowClickArgs args) {
CreateDocument(args.Item);
}
[Command]
public void CreateDocument(object viewModel) {
var doc = DocumentManagerService.FindDocument(viewModel);
if(doc == null) {
doc = DocumentManagerService.CreateDocument("DetailedView", viewModel);
doc.Id = DocumentManagerService.Documents.Count();
}
doc.Show();
}
}
}