Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / CategoryAttribute.cs / 1305376 / CategoryAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System; using System.ComponentModel; using System.Diagnostics; using System.Security.Permissions; ////// [AttributeUsage(AttributeTargets.All)] public class CategoryAttribute : Attribute { private static CategoryAttribute appearance; private static CategoryAttribute asynchronous; private static CategoryAttribute behavior; private static CategoryAttribute data; private static CategoryAttribute design; private static CategoryAttribute action; private static CategoryAttribute format; private static CategoryAttribute layout; private static CategoryAttribute mouse; private static CategoryAttribute key; private static CategoryAttribute focus; private static CategoryAttribute windowStyle; private static CategoryAttribute dragDrop; private static CategoryAttribute defAttr; private bool localized; ///Specifies the category in which the property or event will be displayed in a /// visual designer. ////// private string categoryValue; ////// Provides the actual category name. /// ////// public static CategoryAttribute Action { get { if (action == null) { action = new CategoryAttribute("Action"); } return action; } } ///Gets the action category attribute. ////// public static CategoryAttribute Appearance { get { if (appearance == null) { appearance = new CategoryAttribute("Appearance"); } return appearance; } } ///Gets the appearance category attribute. ////// public static CategoryAttribute Asynchronous { get { if (asynchronous == null) { asynchronous = new CategoryAttribute("Asynchronous"); } return asynchronous; } } ///Gets the asynchronous category attribute. ////// public static CategoryAttribute Behavior { get { if (behavior == null) { behavior = new CategoryAttribute("Behavior"); } return behavior; } } ///Gets the behavior category attribute. ////// public static CategoryAttribute Data { get { if (data == null) { data = new CategoryAttribute("Data"); } return data; } } ///Gets the data category attribute. ////// public static CategoryAttribute Default { get { if (defAttr == null) { defAttr = new CategoryAttribute(); } return defAttr; } } ///Gets the default category attribute. ////// public static CategoryAttribute Design { get { if (design == null) { design = new CategoryAttribute("Design"); } return design; } } ///Gets the design category attribute. ////// public static CategoryAttribute DragDrop { get { if (dragDrop == null) { dragDrop = new CategoryAttribute("DragDrop"); } return dragDrop; } } ///Gets the drag and drop category attribute. ////// public static CategoryAttribute Focus { get { if (focus == null) { focus = new CategoryAttribute("Focus"); } return focus; } } ///Gets the focus category attribute. ////// public static CategoryAttribute Format { get { if (format == null) { format = new CategoryAttribute("Format"); } return format; } } ///Gets the format category attribute. ////// public static CategoryAttribute Key { get { if (key == null) { key = new CategoryAttribute("Key"); } return key; } } ///Gets the keyboard category attribute. ////// public static CategoryAttribute Layout { get { if (layout == null) { layout = new CategoryAttribute("Layout"); } return layout; } } ///Gets the layout category attribute. ////// public static CategoryAttribute Mouse { get { if (mouse == null) { mouse = new CategoryAttribute("Mouse"); } return mouse; } } ///Gets the mouse category attribute. ////// public static CategoryAttribute WindowStyle { get { if (windowStyle == null) { windowStyle = new CategoryAttribute("WindowStyle"); } return windowStyle; } } ///Gets the window style category /// attribute. ////// public CategoryAttribute() : this("Default") { } ///Initializes a new instance of the ////// class with the default category. /// public CategoryAttribute(string category) { this.categoryValue = category; this.localized = false; } ///Initializes a new instance of the ///class with /// the specified category name. /// public string Category { get { if (!localized) { localized = true; string localizedValue = GetLocalizedString(categoryValue); if (localizedValue != null) { categoryValue = localizedValue; } } return categoryValue; } } ///Gets the name of the category for the property or event /// that this attribute is bound to. ////// ////// ////// public override bool Equals(object obj){ if (obj == this) { return true; } if (obj is CategoryAttribute){ return Category.Equals(((CategoryAttribute)obj).Category); } return false; } /// /// public override int GetHashCode() { return Category.GetHashCode(); } ///[To be supplied.] ////// protected virtual string GetLocalizedString(string value) { #if !SILVERLIGHT return (string)SR.GetObject("PropertyCategory" + value); #else bool usedFallback; string localizedString = SR.GetString("PropertyCategory" + value, out usedFallback); if (usedFallback) { return null; } return localizedString; #endif } #if !SILVERLIGHT ///Looks up the localized name of a given category. ////// ////// ////// public override bool IsDefaultAttribute() { return Category.Equals(Default.Category); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System; using System.ComponentModel; using System.Diagnostics; using System.Security.Permissions; ////// [AttributeUsage(AttributeTargets.All)] public class CategoryAttribute : Attribute { private static CategoryAttribute appearance; private static CategoryAttribute asynchronous; private static CategoryAttribute behavior; private static CategoryAttribute data; private static CategoryAttribute design; private static CategoryAttribute action; private static CategoryAttribute format; private static CategoryAttribute layout; private static CategoryAttribute mouse; private static CategoryAttribute key; private static CategoryAttribute focus; private static CategoryAttribute windowStyle; private static CategoryAttribute dragDrop; private static CategoryAttribute defAttr; private bool localized; ///Specifies the category in which the property or event will be displayed in a /// visual designer. ////// private string categoryValue; ////// Provides the actual category name. /// ////// public static CategoryAttribute Action { get { if (action == null) { action = new CategoryAttribute("Action"); } return action; } } ///Gets the action category attribute. ////// public static CategoryAttribute Appearance { get { if (appearance == null) { appearance = new CategoryAttribute("Appearance"); } return appearance; } } ///Gets the appearance category attribute. ////// public static CategoryAttribute Asynchronous { get { if (asynchronous == null) { asynchronous = new CategoryAttribute("Asynchronous"); } return asynchronous; } } ///Gets the asynchronous category attribute. ////// public static CategoryAttribute Behavior { get { if (behavior == null) { behavior = new CategoryAttribute("Behavior"); } return behavior; } } ///Gets the behavior category attribute. ////// public static CategoryAttribute Data { get { if (data == null) { data = new CategoryAttribute("Data"); } return data; } } ///Gets the data category attribute. ////// public static CategoryAttribute Default { get { if (defAttr == null) { defAttr = new CategoryAttribute(); } return defAttr; } } ///Gets the default category attribute. ////// public static CategoryAttribute Design { get { if (design == null) { design = new CategoryAttribute("Design"); } return design; } } ///Gets the design category attribute. ////// public static CategoryAttribute DragDrop { get { if (dragDrop == null) { dragDrop = new CategoryAttribute("DragDrop"); } return dragDrop; } } ///Gets the drag and drop category attribute. ////// public static CategoryAttribute Focus { get { if (focus == null) { focus = new CategoryAttribute("Focus"); } return focus; } } ///Gets the focus category attribute. ////// public static CategoryAttribute Format { get { if (format == null) { format = new CategoryAttribute("Format"); } return format; } } ///Gets the format category attribute. ////// public static CategoryAttribute Key { get { if (key == null) { key = new CategoryAttribute("Key"); } return key; } } ///Gets the keyboard category attribute. ////// public static CategoryAttribute Layout { get { if (layout == null) { layout = new CategoryAttribute("Layout"); } return layout; } } ///Gets the layout category attribute. ////// public static CategoryAttribute Mouse { get { if (mouse == null) { mouse = new CategoryAttribute("Mouse"); } return mouse; } } ///Gets the mouse category attribute. ////// public static CategoryAttribute WindowStyle { get { if (windowStyle == null) { windowStyle = new CategoryAttribute("WindowStyle"); } return windowStyle; } } ///Gets the window style category /// attribute. ////// public CategoryAttribute() : this("Default") { } ///Initializes a new instance of the ////// class with the default category. /// public CategoryAttribute(string category) { this.categoryValue = category; this.localized = false; } ///Initializes a new instance of the ///class with /// the specified category name. /// public string Category { get { if (!localized) { localized = true; string localizedValue = GetLocalizedString(categoryValue); if (localizedValue != null) { categoryValue = localizedValue; } } return categoryValue; } } ///Gets the name of the category for the property or event /// that this attribute is bound to. ////// ////// ////// public override bool Equals(object obj){ if (obj == this) { return true; } if (obj is CategoryAttribute){ return Category.Equals(((CategoryAttribute)obj).Category); } return false; } /// /// public override int GetHashCode() { return Category.GetHashCode(); } ///[To be supplied.] ////// protected virtual string GetLocalizedString(string value) { #if !SILVERLIGHT return (string)SR.GetObject("PropertyCategory" + value); #else bool usedFallback; string localizedString = SR.GetString("PropertyCategory" + value, out usedFallback); if (usedFallback) { return null; } return localizedString; #endif } #if !SILVERLIGHT ///Looks up the localized name of a given category. ////// ////// ////// public override bool IsDefaultAttribute() { return Category.Equals(Default.Category); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IssuedTokenParametersEndpointAddressElement.cs
- WaitForChangedResult.cs
- InternalCache.cs
- PropertyTab.cs
- AccessDataSourceWizardForm.cs
- WebPartDisplayMode.cs
- BindableAttribute.cs
- NativeMethods.cs
- CodeSnippetTypeMember.cs
- XamlTreeBuilderBamlRecordWriter.cs
- HealthMonitoringSection.cs
- StateManagedCollection.cs
- SystemException.cs
- ExpressionPrinter.cs
- ToolStripItemEventArgs.cs
- FileDataSourceCache.cs
- Publisher.cs
- DataGridItem.cs
- SafeSystemMetrics.cs
- BaseTreeIterator.cs
- WindowsListViewGroupHelper.cs
- log.cs
- CodeParameterDeclarationExpression.cs
- NetDispatcherFaultException.cs
- CodeDirectiveCollection.cs
- ExeContext.cs
- MetadataUtil.cs
- QueryResponse.cs
- SubstitutionResponseElement.cs
- ListViewDeletedEventArgs.cs
- DataGridSortCommandEventArgs.cs
- TimeoutException.cs
- SafeEventLogReadHandle.cs
- FlowDecisionDesigner.xaml.cs
- CacheChildrenQuery.cs
- EmptyCollection.cs
- ProtocolViolationException.cs
- SimpleFieldTemplateFactory.cs
- AddIn.cs
- XmlEnumAttribute.cs
- ADConnectionHelper.cs
- FrameworkObject.cs
- EnvelopedPkcs7.cs
- EntityContainerEmitter.cs
- ColumnResizeAdorner.cs
- XmlILIndex.cs
- MappingException.cs
- CustomAttribute.cs
- DocumentGridPage.cs
- CompositeFontFamily.cs
- ITextView.cs
- AuthenticationService.cs
- TcpDuplicateContext.cs
- IconConverter.cs
- QualifiedCellIdBoolean.cs
- FormsAuthentication.cs
- DragDrop.cs
- HintTextConverter.cs
- CharAnimationUsingKeyFrames.cs
- WorkflowInstanceProvider.cs
- KeyedCollection.cs
- HtmlHistory.cs
- PhoneCallDesigner.cs
- RenderingBiasValidation.cs
- FontFamilyIdentifier.cs
- FileVersionInfo.cs
- SafeCancelMibChangeNotify.cs
- FixedPageProcessor.cs
- PaintEvent.cs
- TablePatternIdentifiers.cs
- followingquery.cs
- XmlLanguageConverter.cs
- ReachDocumentPageSerializerAsync.cs
- SafeThreadHandle.cs
- SHA1Managed.cs
- SmtpCommands.cs
- XmlSchemaAttribute.cs
- ListenerElementsCollection.cs
- CachedTypeface.cs
- SQLChars.cs
- PrintPreviewGraphics.cs
- CurrentChangedEventManager.cs
- CommentEmitter.cs
- autovalidator.cs
- XmlDocumentType.cs
- DataSetUtil.cs
- SafeWaitHandle.cs
- Sentence.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- GenericUriParser.cs
- IgnoreDataMemberAttribute.cs
- Grammar.cs
- KeyedHashAlgorithm.cs
- SafeCloseHandleCritical.cs
- FileSystemEventArgs.cs
- BitmapCodecInfoInternal.cs
- StreamResourceInfo.cs
- StateMachine.cs
- DataConnectionHelper.cs
- ConfigurationLocationCollection.cs