-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathInputAttribute.cs
More file actions
63 lines (56 loc) · 2.4 KB
/
Copy pathInputAttribute.cs
File metadata and controls
63 lines (56 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -------------------------------------------------------------------------------------------
// <copyright file="InputAttribute.cs" company="MapWindow OSS Team - www.mapwindow.org">
// MapWindow OSS Team - 2015
// </copyright>
// -------------------------------------------------------------------------------------------
using System;
using MW5.Tools.Enums;
namespace MW5.Tools.Model
{
/// <summary>
/// Represents attribute to mark tool properties as input parameters.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class InputAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="InputAttribute"/> class.
/// </summary>
/// <param name="displayName">The display name.</param>
/// <param name="index">The index. -1 should be passed to exclude parameter for UI.</param>
/// <param name="optional">True if parameter must be displayed on the optional panel.</param>
public InputAttribute(string displayName, int index, bool optional = false)
{
DisplayName = displayName;
Index = index;
Optional = optional;
SectionName = string.Empty;
}
/// <summary>
/// Initializes a new instance of the <see cref="InputAttribute"/> class.
/// </summary>
/// <param name="displayName">The display name.</param>
/// <param name="index">The index. -1 should be passed to exclude parameter from UI.</param>
/// <param name="sectionName">The name of the section which will be displayed as a separate section or panel in the UI.</param>
public InputAttribute(string displayName, int index, string sectionName)
{
DisplayName = displayName;
Index = index;
Optional = true;
SectionName = sectionName;
}
public bool Optional { get; set; }
/// <summary>
/// Gets the display name.
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the index.
/// </summary>
public int Index { get; set; }
/// <summary>
/// Gets or sets the name of the section which will be displayed as a separate section or panel in the UI.
/// </summary>
public string SectionName { get; set; }
}
}