Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Input / Command / RoutedUICommand.cs / 1 / RoutedUICommand.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Windows; using System.Windows.Markup; using System.Windows.Media; namespace System.Windows.Input { ////// RoutedCommand with added UI Information. /// [TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=" + Microsoft.Internal.BuildInfo.WCP_VERSION + ", Culture=neutral, PublicKeyToken=" + Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_TOKEN + ", Custom=null")] public class RoutedUICommand : RoutedCommand { ////// Default Constructor - needed to allow markup creation /// public RoutedUICommand() : base() { _text = String.Empty; } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property public RoutedUICommand(string text, string name, Type ownerType) : this(text, name, ownerType, null) { } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// Default Input Gestures associated public RoutedUICommand(string text, string name, Type ownerType, InputGestureCollection inputGestures) : base(name, ownerType, inputGestures) { if (text == null) { throw new ArgumentNullException("text"); } _text = text; } ////// Creates an instance of this class. Allows lazy initialization of InputGestureCollection and Text properties. /// /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// An identifier assigned by the owning type to the command internal RoutedUICommand(string name, Type ownerType, byte commandId):base(name, ownerType, commandId) { } ////// Descriptive and localizable text for the command. /// public string Text { get { if(_text == null) { _text = GetText(); } return _text; } set { if (value == null) { throw new ArgumentNullException("value"); } _text = value; } } ////// Fetches the text by invoking the GetUIText function on the owning type. /// ///The text for the command private string GetText() { if(OwnerType == typeof(ApplicationCommands)) { return ApplicationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(NavigationCommands)) { return NavigationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(MediaCommands)) { return MediaCommands.GetUIText(CommandId); } else if(OwnerType == typeof(ComponentCommands)) { return ComponentCommands.GetUIText(CommandId); } return null; } private string _text; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Windows; using System.Windows.Markup; using System.Windows.Media; namespace System.Windows.Input { ////// RoutedCommand with added UI Information. /// [TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=" + Microsoft.Internal.BuildInfo.WCP_VERSION + ", Culture=neutral, PublicKeyToken=" + Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_TOKEN + ", Custom=null")] public class RoutedUICommand : RoutedCommand { ////// Default Constructor - needed to allow markup creation /// public RoutedUICommand() : base() { _text = String.Empty; } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property public RoutedUICommand(string text, string name, Type ownerType) : this(text, name, ownerType, null) { } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// Default Input Gestures associated public RoutedUICommand(string text, string name, Type ownerType, InputGestureCollection inputGestures) : base(name, ownerType, inputGestures) { if (text == null) { throw new ArgumentNullException("text"); } _text = text; } ////// Creates an instance of this class. Allows lazy initialization of InputGestureCollection and Text properties. /// /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// An identifier assigned by the owning type to the command internal RoutedUICommand(string name, Type ownerType, byte commandId):base(name, ownerType, commandId) { } ////// Descriptive and localizable text for the command. /// public string Text { get { if(_text == null) { _text = GetText(); } return _text; } set { if (value == null) { throw new ArgumentNullException("value"); } _text = value; } } ////// Fetches the text by invoking the GetUIText function on the owning type. /// ///The text for the command private string GetText() { if(OwnerType == typeof(ApplicationCommands)) { return ApplicationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(NavigationCommands)) { return NavigationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(MediaCommands)) { return MediaCommands.GetUIText(CommandId); } else if(OwnerType == typeof(ComponentCommands)) { return ComponentCommands.GetUIText(CommandId); } return null; } private string _text; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ViewCellRelation.cs
- WebControl.cs
- StateRuntime.cs
- PipeStream.cs
- DateTimeFormatInfoScanner.cs
- TdsParser.cs
- Solver.cs
- IndentTextWriter.cs
- Interlocked.cs
- SqlWriter.cs
- SmtpNtlmAuthenticationModule.cs
- CommunicationObjectFaultedException.cs
- SmtpReplyReader.cs
- DisplayInformation.cs
- TakeQueryOptionExpression.cs
- COAUTHINFO.cs
- GradientStop.cs
- FloaterBaseParagraph.cs
- SystemIPInterfaceStatistics.cs
- TabControlAutomationPeer.cs
- DoubleStorage.cs
- BaseCodePageEncoding.cs
- UnknownWrapper.cs
- WindowsIdentity.cs
- TimeSpanSecondsConverter.cs
- ComplexPropertyEntry.cs
- WorkflowNamespace.cs
- ElementNotEnabledException.cs
- NativeActivity.cs
- RowVisual.cs
- XmlAnyElementAttribute.cs
- FilteredSchemaElementLookUpTable.cs
- DoubleMinMaxAggregationOperator.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- GenericWebPart.cs
- RegexCapture.cs
- DocumentSequenceHighlightLayer.cs
- FileIOPermission.cs
- TraceContextEventArgs.cs
- ZeroOpNode.cs
- PointConverter.cs
- GetWinFXPath.cs
- OleDbPropertySetGuid.cs
- LineGeometry.cs
- InputMethodStateChangeEventArgs.cs
- XmlComment.cs
- webeventbuffer.cs
- ExceptQueryOperator.cs
- WmlValidatorAdapter.cs
- EventSetter.cs
- MailBnfHelper.cs
- MultilineStringConverter.cs
- HealthMonitoringSectionHelper.cs
- SerTrace.cs
- WindowsRebar.cs
- RedirectionProxy.cs
- FacetChecker.cs
- SqlGenericUtil.cs
- MessageBox.cs
- CryptographicAttribute.cs
- ItemsChangedEventArgs.cs
- SystemColorTracker.cs
- OptionUsage.cs
- ClientSideProviderDescription.cs
- InlineObject.cs
- VerticalAlignConverter.cs
- DynamicMethod.cs
- IntSecurity.cs
- IndentedWriter.cs
- OleDbRowUpdatingEvent.cs
- StylusEditingBehavior.cs
- ConcurrentDictionary.cs
- DiscriminatorMap.cs
- EntityDataSourceColumn.cs
- NumericUpDown.cs
- BypassElement.cs
- BitmapFrameDecode.cs
- WSSecurityPolicy12.cs
- Socket.cs
- SqlServer2KCompatibilityCheck.cs
- SyndicationCategory.cs
- DataControlExtensions.cs
- ProxyWebPartConnectionCollection.cs
- HwndSourceKeyboardInputSite.cs
- User.cs
- GenericNameHandler.cs
- RectangleF.cs
- ActivitySurrogate.cs
- MetabaseServerConfig.cs
- DataViewManagerListItemTypeDescriptor.cs
- _HelperAsyncResults.cs
- SqlLiftWhereClauses.cs
- MapPathBasedVirtualPathProvider.cs
- EdmConstants.cs
- UndoUnit.cs
- SpeechDetectedEventArgs.cs
- ApplicationSettingsBase.cs
- CodeAttachEventStatement.cs
- _ServiceNameStore.cs
- TextControlDesigner.cs