LoginSignup
1
2

More than 5 years have passed since last update.

AsyncReactiveCommandのコードスニペット

Last updated at Posted at 2017-02-07

背景

17/03/28 追記:※ReactiveProperty3.6.0からこのコードスニペットが含まれます。

既存のReactiveProperty関連のコードスニペットとして

  • ReactiveCollection
  • ReactiveCommand
  • ReactiveCommandGeneric
  • ReactiveProperty
  • ReadOnlyReactiveCollection
  • ReadOnlyReactiveProperty

はありますが、AsyncReactiveCommandのスニペットは無かったので作りました。
なお、上記コードスニペットは
ReactivePropertyをnugetで取得するとついてきますが、
使用するためには手動でコードスニペットマネージャーに追加する必要があります。

コード

AsyncReactiveCommand.snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Keywords>
        <Keyword>arcomm</Keyword>
      </Keywords>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>AsyncReactiveCommand</Title>
      <Author>soi</Author>
      <Description>AsyncReactiveCommand Non Generic</Description>
      <Shortcut>arcomm</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>CommandName</ID>
          <Default>CommandName</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[public AsyncReactiveCommand $CommandName$ { get; }$end$]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
AsyncReactiveCommandGeneric.snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Keywords>
        <Keyword>arcommg</Keyword>
      </Keywords>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>AsyncReactiveCommandGeneric</Title>
      <Author>soi</Author>
      <Description>AsyncReactiveCommand Generic</Description>
      <Shortcut>arcommg</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>T</ID>
          <Default>T</Default>
        </Literal>
        <Literal Editable="true">
          <ID>CommandName</ID>
          <Default>CommandName</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[public AsyncReactiveCommand<$T$> $CommandName$ { get; }$end$]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

使用方法

上記コードのファイルを作成して、
VisualStudioのコードスニペットマネージャーから追加できます。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2