Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/HL3Snippets/HL3.DefineEvent.snippet @ 5779

Last change on this file since 5779 was 5036, checked in by epitzer, 14 years ago

Add snippets for defining events and firing methods (#567)

File size: 1.0 KB
Line 
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.DefineEvent</Title>
9      <Author>Erik Pitzer</Author>
10      <Description>Defines a new event and a corresponding firing method.</Description>
11      <Shortcut>hl3DefineEvent</Shortcut>
12    </Header>
13    <Snippet>
14      <Declarations>
15        <Literal Editable="true">
16          <ID>EventName</ID>
17          <ToolTip>EventName</ToolTip>
18          <Default>EventName</Default>
19          <Function>
20          </Function>
21        </Literal>
22      </Declarations>
23      <Code Language="csharp"><![CDATA[public event EventHandler $EventName$;
24
25protected virtual void On$EventName$() {
26  EventHandler handler = $EventName$;
27  if (handler != null)
28    handler(this, EventArgs.Empty);
29}]]></Code>
30    </Snippet>
31  </CodeSnippet>
32</CodeSnippets>
Note: See TracBrowser for help on using the repository browser.