Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/HL3Snippets/HL3.DefineGenericEvent.snippet @ 5061

Last change on this file since 5061 was 5061, checked in by epitzer, 13 years ago

Correct typo in generic event snipped (#567)

File size: 1.4 KB
RevLine 
[5036]1<?xml version="1.0" encoding="utf-8"?>
2<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
3  <CodeSnippet Format="1.0.0">
4    <Header>
5      <SnippetTypes>
6        <SnippetType>Expansion</SnippetType>
7      </SnippetTypes>
8      <Title>HL3.DefineGenericEvent</Title>
9      <Author>Erik Pitzer</Author>
10      <Description>Defines a generic events an a corresponing firing method.</Description>
11      <Shortcut>hl3DefineGenericEvent</Shortcut>
12    </Header>
13    <Snippet>
14      <Imports>
15        <Import>
16          <Namespace>HeuristicLab.Common</Namespace>
17        </Import>
18      </Imports>
19      <Declarations>
20        <Literal Editable="true">
21          <ID>ArgsType</ID>
22          <ToolTip>ArgsType</ToolTip>
23          <Default>ArgsType</Default>
24          <Function>
25          </Function>
26        </Literal>
27        <Literal Editable="true">
28          <ID>EventName</ID>
29          <ToolTip>EventName</ToolTip>
30          <Default>EventName</Default>
31          <Function>
32          </Function>
33        </Literal>
34      </Declarations>
35      <Code Language="csharp"><![CDATA[public event EventHandler<EventArgs<$ArgsType$>> $EventName$;
36
37protected virtual void On$EventName$($ArgsType$ args) {
38  EventHandler<EventArgs<$ArgsType$>> handler = $EventName$;
[5061]39  if (handler != null)
[5036]40    handler(this, new EventArgs<$ArgsType$>(args));
41}]]></Code>
42    </Snippet>
43  </CodeSnippet>
44</CodeSnippets>
Note: See TracBrowser for help on using the repository browser.