Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions snippets/Visual Studio/ruicommand.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Command type</ToolTip>
<Default>object</Default>
<ID>TParam</ID>
<ToolTip>Type of parameter</ToolTip>
<Default>Unit</Default>
</Literal>
<Literal>
<ID>TResult</ID>
<ToolTip>Type of result</ToolTip>
<Default>Unit</Default>
</Literal>
<Literal>
<ID>command</ID>
<ToolTip>Command name</ToolTip>
<Default>DoSomething</Default>
</Literal>
</Declarations>
<Imports>
<Import>
<Namespace>System.Reactive</Namespace>
</Import>
<Import>
<Namespace>ReactiveUI</Namespace>
</Import>
</Imports>
<Code Language="csharp">
<![CDATA[public ReactiveCommand<$type$> $command$ { get; private set; }$end$]]>
<![CDATA[public ReactiveCommand<$TParam$, $TResult$> $command$ { get; }$end$]]>
</Code>
</Snippet>
</CodeSnippet>
Expand Down
7 changes: 6 additions & 1 deletion snippets/Visual Studio/ruiinteraction.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<Default>Unit</Default>
<ToolTip>Interaction's output type</ToolTip>
</Literal>
<Literal>
<ID>interaction</ID>
<ToolTip>Interaction name</ToolTip>
<Default>DoSomethingInteraction</Default>
</Literal>
</Declarations>
<Imports>
<Import>
Expand All @@ -31,7 +36,7 @@
</Import>
</Imports>
<Code Language="CSharp">
<![CDATA[public Interaction<$TInput$, $TOutput$> DoSomethingInteraction => new Interaction<$TInput$, $TOutput$>();$end$]]>
<![CDATA[public Interaction<$TInput$, $TOutput$> $interaction$ { get; } = new Interaction<$TInput$, $TOutput$>();$end$]]>
</Code>
</Snippet>
</CodeSnippet>
Expand Down
10 changes: 5 additions & 5 deletions snippets/Visual Studio/ruiiv4.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
</Declarations>
<Code Language="csharp">
<![CDATA[public static readonly DependencyProperty ViewModelProperty =
DependencyProperty.Register("ViewModel", typeof($classname$Model), typeof($classname$), new PropertyMetadata(null));
DependencyProperty.Register(nameof(ViewModel), typeof($classname$Model), typeof($classname$), new PropertyMetadata(default($classname$Model)));

public $classname$Model ViewModel
{
get { return ($classname$Model)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
get => ($classname$Model)GetValue(ViewModelProperty);
set => SetValue(ViewModelProperty, value);
}

object IViewFor.ViewModel
{
get { return ViewModel; }
set { ViewModel = ($classname$Model)value; }
get => ViewModel;
set => ViewModel = ($classname$Model)value;
}$end$]]>
</Code>
</Snippet>
Expand Down
24 changes: 16 additions & 8 deletions snippets/Visual Studio/ruioaph.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
<ID>fieldName</ID>
<ToolTip>Name of backing field</ToolTip>
<Default>myField</Default>
</Literal>
<Literal>
<ID>propertyName</ID>
<ToolTip>Name of property</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[private ObservableAsPropertyHelper<$type$> _$property$;
public $type$ $property$
{
get {return _$property$.Value;}
}$end$]]>
<Imports>
<Import>
<Namespace>ReactiveUI</Namespace>
</Import>
</Imports>
<Code Language="csharp">
<![CDATA[private ObservableAsPropertyHelper<$type$> $fieldName$;
public $type$ $propertyName$ => $fieldName$.Value;$end$]]>
</Code>
</Snippet>
</CodeSnippet>
Expand Down
12 changes: 9 additions & 3 deletions snippets/Visual Studio/ruiprop.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@
<Literal Editable="true">
<ID>propertyName</ID>
<ToolTip>Name of property</ToolTip>
<Default>myProperty</Default>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp" Delimiter="$"><![CDATA[public $type$ $propertyName$ { get => $fieldName$; set => this.RaiseAndSetIfChanged(ref $fieldName$, value); }$end$]]>
</Code>
<Code Language="csharp" Delimiter="$">
<![CDATA[private $type$ $fieldName$;
public $type$ $propertyName$
{
get => $fieldName$;
set => this.RaiseAndSetIfChanged(ref $fieldName$, value);
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>