-
Notifications
You must be signed in to change notification settings - Fork 2
/
vmlist.template.xml
72 lines (62 loc) · 1.88 KB
/
vmlist.template.xml
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
<?xml version="1.0" encoding="utf-8"?>
<CodeTemplates version="3.0">
<CodeTemplate version="2.0">
<Header>
<_Group>C#</_Group>
<Version />
<MimeType>text/x-csharp</MimeType>
<Shortcut>vmlist</Shortcut>
<_Description>vm template for lists</_Description>
<TemplateType>Unknown</TemplateType>
</Header>
<Variables>
<Variable name="Name">
<Default>MyClass</Default>
</Variable>
<Variable name="ModelName">
<Default>object</Default>
</Variable>
</Variables>
<Code><![CDATA[public class $Name$ : ViewModelBase<$Name$>
{
//using System;
//using System.Reactive;
//using System.Reactive.Linq;
//using System.Runtime.Serialization;
//using System.Threading.Tasks;
//using EightBot.BigBang.Extensions;
//using EightBot.BigBang.ViewModel;
//using FluentValidation;
//using ReactiveUI;
//using Splat;
public override string Title => string.Empty;
public ReactiveList<$ModelName$> Data = new ReactiveList<$ModelName$>();
public override AbstractValidator<$Name$> Validator => null;
public $Name$() {}
protected override void Initialize()
{
base.Initialize();
}
ReactiveCommand<$TParam$, $TReturn$> _$someCommand$;
public ReactiveCommand<$TParam$, $TReturn$> $SomeCommand$
{
get => _$someCommand$;
private set => this.RaiseAndSetIfChanged(ref _$someCommand$, value);
}
protected override void RegisterObservables()
{
InitializeData =
ReactiveCommand
.Create<Unit, unit>(_ =>
{
using (Data.SuppressChangeNotifications())
{
Data.Clear();
}
return Unit.Default;
})
.DisposeWith(ViewModelBindings);
}
}]]></Code>
</CodeTemplate>
</CodeTemplates>