Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/HL3Snippets/HL3.ViewStub.snippet @ 11159

Last change on this file since 11159 was 4761, checked in by abeham, 14 years ago

#567

  • Added snippets to source control
File size: 3.1 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      <Title>HL3.ViewStub</Title>
6      <Author>Andreas Beham</Author>
7      <Description>Creates a stub implementation of a view</Description>
8      <HelpUrl>https://dev.heuristiclab.com/trac/hl/core/wiki/DevelopersCodeSnippets</HelpUrl>
9      <SnippetTypes>
10        <SnippetType>Expansion</SnippetType>
11      </SnippetTypes>
12      <Keywords />
13      <Shortcut>hl3ViewClass</Shortcut>
14    </Header>
15    <Snippet>
16      <References />
17      <Imports />
18      <Declarations>
19        <Literal Editable="true">
20          <ID>ViewName</ID>
21          <Type></Type>
22          <ToolTip>Name of the view</ToolTip>
23          <Default>My Great View</Default>
24          <Function></Function>
25        </Literal>
26        <Literal Editable="true">
27          <ID>ContentType</ID>
28          <Type></Type>
29          <ToolTip>Type of the content to view</ToolTip>
30          <Default>YourModelClassName</Default>
31          <Function></Function>
32        </Literal>
33        <Literal Editable="true">
34          <ID>DefaultView</ID>
35          <Type></Type>
36          <ToolTip>True if the view is the default view for the given content type. Beware: There can only be one default view per content type!</ToolTip>
37          <Default>false</Default>
38          <Function></Function>
39        </Literal>
40        <Literal Editable="true">
41          <ID>BaseView</ID>
42          <Type></Type>
43          <ToolTip>The base class for this view to derive from</ToolTip>
44          <Default>NamedItemView</Default>
45          <Function></Function>
46        </Literal>
47      </Declarations>
48      <Code Language="csharp" Kind="" Delimiter="$"><![CDATA[[View("$ViewName$")]
49[Content(typeof($ContentType$), IsDefaultView = $DefaultView$)]
50public sealed partial class $ContentType$View : $BaseView$ {
51  public new $ContentType$ Content {
52    get { return ($ContentType$)base.Content; }
53    set { base.Content = value; }
54  }
55
56  public $ContentType$View() {
57    InitializeComponent();
58  }
59
60  protected override void DeregisterContentEvents() {
61    // TODO: Deregister your event handlers here
62    base.DeregisterContentEvents();
63    }
64
65  protected override void RegisterContentEvents() {
66    base.RegisterContentEvents();
67    // TODO: Register your event handlers here
68    }
69
70    #region Event Handlers (Content)
71    // TODO: Put event handlers of the content here
72    #endregion
73
74  protected override void OnContentChanged() {
75    base.OnContentChanged();
76    if (Content == null) {
77          // TODO: Add code when content has been changed and is null
78    } else {
79          // TODO: Add code when content has been changed and is not null
80    }
81    }
82
83
84    protected override void SetEnabledStateOfControls() {
85    base.SetEnabledStateOfControls();
86    // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
87    }
88
89    #region Event Handlers (child controls)
90    // TODO: Put event handlers of child controls here.
91    #endregion
92}]]></Code>
93    </Snippet>
94  </CodeSnippet>
95</CodeSnippets>
Note: See TracBrowser for help on using the repository browser.