1 // Copyright (c) Microsoft. All rights reserved. 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 //-------------------------------------------------------------------------------- 4 // </copyright> 5 // <summary> Represents a category to which a property can belong to. </summary> 6 //-------------------------------------------------------------------------------- 7 8 using System; 9 using System.ComponentModel; 10 using System.Windows.Markup; 11 12 namespace Microsoft.Build.Framework.XamlTypes 13 { 14 /// <summary> 15 /// Represents a category to which a <see cref="BaseProperty"/> can belong to. 16 /// </summary> 17 /// <remarks> 18 /// Those who manually 19 /// instantiate this class should remember to call <see cref="BeginInit"/> before setting the first 20 /// property and <see cref="EndInit"/> after setting the last property of the object. 21 /// </remarks> 22 /// <comment> 23 /// This partial class contains all properties which are public and hence settable in XAML. Those properties that 24 /// are internal are defined in another partial class below. 25 /// </comment> 26 public sealed partial class Category : CategorySchema, ISupportInitialize 27 { 28 #region Fields 29 30 /// <summary> 31 /// See DisplayName property. 32 /// </summary> 33 private string _displayName; 34 35 #endregion 36 37 #region Properties 38 39 /// <summary> 40 /// The name of this <see cref="Category"/>. 41 /// </summary> 42 /// <remarks> 43 /// This field is mandatory and culture invariant. 44 /// This field cannot be set to the empty string. 45 /// </remarks> 46 public string Name 47 { 48 get; 49 set; 50 } 51 52 /// <summary> 53 /// The name that could be used by a prospective UI client to display this <see cref="Category"/>. 54 /// </summary> 55 /// <remarks> 56 /// This field is optional and is culture sensitive. When this property is not set, it is assigned the same 57 /// value as the <see cref="Name"/> property (and hence, would not be localized). 58 /// </remarks> 59 [Localizable(true)] 60 public string DisplayName 61 { 62 get 63 { 64 return _displayName ?? Name; 65 } 66 67 set 68 { 69 _displayName = value; 70 } 71 } 72 73 /// <summary> 74 /// Description of this <see cref="Category"/>. 75 /// </summary> 76 /// <remarks> 77 /// This field is optional and is culture sensitive. 78 /// </remarks> 79 [Localizable(true)] 80 public string Description 81 { 82 get; 83 set; 84 } 85 86 /// <summary> 87 /// Subtype of this <see cref="Category"/>. Is either <c>Grid</c> (default) or <c>CommandLine</c>. 88 /// </summary> 89 /// <remarks> 90 /// It helps the UI display this category in an appropriate form. E.g. non command line category 91 /// properties are normally displayed in the form of a property grid. 92 /// </remarks> 93 public string Subtype 94 { 95 get; 96 set; 97 } 98 99 /// <summary> 100 /// Help information for this <see cref="Category"/>. 101 /// </summary> 102 /// <remarks> 103 /// Maybe used to specify a help URL. This field 104 /// is optional and is culture sensitive. 105 /// </remarks> 106 [Localizable(true)] 107 public string HelpString 108 { 109 get; 110 set; 111 } 112 113 #endregion 114 } 115 116 /// <summary> 117 /// Represents a category to which a <see cref="BaseProperty"/> can belong to. 118 /// </summary> 119 /// <remarks> 120 /// Those who manually 121 /// instantiate this class should remember to call <see cref="BeginInit"/> before setting the first 122 /// property and <see cref="EndInit"/> after setting the last property of the object. 123 /// </remarks> 124 /// <comment> 125 /// This partial class contains members that are auto-generated, internal, etc. Whereas the 126 /// other partial class contains public properties that can be set in XAML. 127 /// </comment> 128 public sealed partial class Category : CategorySchema, ISupportInitialize 129 { 130 // This partial class contains members that are auto-generated, internal, etc. 131 #region Constructor 132 133 /// <summary> 134 /// Default constructor. Called during deserialization. 135 /// </summary> Category()136 public Category() 137 { 138 Subtype = "Grid"; 139 } 140 141 #endregion // Constructor 142 143 #region ISupportInitialize Members 144 145 /// <summary> 146 /// See ISupportInitialize. 147 /// </summary> BeginInit()148 public void BeginInit() 149 { 150 } 151 152 /// <summary> 153 /// See ISupportInitialize. 154 /// </summary> EndInit()155 public void EndInit() 156 { 157 } 158 159 #endregion 160 } 161 } 162