Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / PasswordBoxAutomationPeer.cs / 1 / PasswordBoxAutomationPeer.cs
//---------------------------------------------------------------------------- // // File: PasswordBoxAutomationPeer.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: The AutomationPeer for PasswordBox. // //--------------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class PasswordBoxAutomationPeer : FrameworkElementAutomationPeer, IValueProvider { ////// Constructor /// /// PasswordBox for which this is an AutomationPeer public PasswordBoxAutomationPeer(PasswordBox owner): base(owner) {} ////// Class name for the type for which this is a peer. /// ///override protected string GetClassNameCore() { return "PasswordBox"; } /// /// Type for which this is a peer. /// ///override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Edit; } /// /// Return the patterns supported by PasswordBoxAutomationPeer /// /// ///override public object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Value) { returnValue = this; } else if (patternInterface == PatternInterface.Scroll) { PasswordBox owner = (PasswordBox)Owner; if (owner.ScrollViewer != null) { returnValue = owner.ScrollViewer.CreateAutomationPeer(); ((AutomationPeer)returnValue).EventsSource = this; } } return returnValue; } /// /// Indicates whether or not this is a password control /// ///true override protected bool IsPasswordCore() { return true; } bool IValueProvider.IsReadOnly { get { return false; } } string IValueProvider.Value { get { throw new InvalidOperationException(); } } void IValueProvider.SetValue(string value) { if(!IsEnabled()) throw new ElementNotEnabledException(); PasswordBox owner = (PasswordBox)Owner; if (value == null) { throw new ArgumentNullException("value"); } owner.Password = value; } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseValuePropertyChangedEvent(string oldValue, string newValue) { if (oldValue != newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldValue, newValue); } } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseIsReadOnlyPropertyChangedEvent(bool oldValue, bool newValue) { if (oldValue != newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty, oldValue, newValue); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: PasswordBoxAutomationPeer.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: The AutomationPeer for PasswordBox. // //--------------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class PasswordBoxAutomationPeer : FrameworkElementAutomationPeer, IValueProvider { ////// Constructor /// /// PasswordBox for which this is an AutomationPeer public PasswordBoxAutomationPeer(PasswordBox owner): base(owner) {} ////// Class name for the type for which this is a peer. /// ///override protected string GetClassNameCore() { return "PasswordBox"; } /// /// Type for which this is a peer. /// ///override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Edit; } /// /// Return the patterns supported by PasswordBoxAutomationPeer /// /// ///override public object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Value) { returnValue = this; } else if (patternInterface == PatternInterface.Scroll) { PasswordBox owner = (PasswordBox)Owner; if (owner.ScrollViewer != null) { returnValue = owner.ScrollViewer.CreateAutomationPeer(); ((AutomationPeer)returnValue).EventsSource = this; } } return returnValue; } /// /// Indicates whether or not this is a password control /// ///true override protected bool IsPasswordCore() { return true; } bool IValueProvider.IsReadOnly { get { return false; } } string IValueProvider.Value { get { throw new InvalidOperationException(); } } void IValueProvider.SetValue(string value) { if(!IsEnabled()) throw new ElementNotEnabledException(); PasswordBox owner = (PasswordBox)Owner; if (value == null) { throw new ArgumentNullException("value"); } owner.Password = value; } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseValuePropertyChangedEvent(string oldValue, string newValue) { if (oldValue != newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldValue, newValue); } } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseIsReadOnlyPropertyChangedEvent(bool oldValue, bool newValue) { if (oldValue != newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty, oldValue, newValue); } } } } // 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
- X509RecipientCertificateServiceElement.cs
- IRCollection.cs
- TextAdaptor.cs
- MsmqOutputMessage.cs
- TreeViewTemplateSelector.cs
- PrimaryKeyTypeConverter.cs
- NamedPipeTransportManager.cs
- HashJoinQueryOperatorEnumerator.cs
- TextEditorMouse.cs
- PublisherMembershipCondition.cs
- DesignerGenericWebPart.cs
- ScriptModule.cs
- VirtualDirectoryMapping.cs
- BmpBitmapEncoder.cs
- SizeChangedEventArgs.cs
- DependencyPropertyKind.cs
- IriParsingElement.cs
- ProfilePropertyMetadata.cs
- BindingExpressionUncommonField.cs
- ServiceNameElementCollection.cs
- XmlLoader.cs
- HtmlGenericControl.cs
- WeakEventManager.cs
- Canvas.cs
- ProfileInfo.cs
- ButtonPopupAdapter.cs
- CacheSection.cs
- ObjectAnimationUsingKeyFrames.cs
- ActivitiesCollection.cs
- IndexedGlyphRun.cs
- ISAPIRuntime.cs
- FrameworkContentElementAutomationPeer.cs
- OdbcConnectionFactory.cs
- DoWorkEventArgs.cs
- MultiBindingExpression.cs
- CheckBox.cs
- HttpHeaderCollection.cs
- XamlPathDataSerializer.cs
- WrapPanel.cs
- XmlArrayAttribute.cs
- PersonalizationDictionary.cs
- NativeActivity.cs
- RestHandlerFactory.cs
- LambdaCompiler.Logical.cs
- WebMethodAttribute.cs
- GridSplitter.cs
- TextRunTypographyProperties.cs
- TreeBuilderBamlTranslator.cs
- HandleValueEditor.cs
- DelegatingTypeDescriptionProvider.cs
- MimeMultiPart.cs
- Line.cs
- ToolStripStatusLabel.cs
- Rect3D.cs
- KoreanCalendar.cs
- EmbeddedMailObject.cs
- ExtenderProviderService.cs
- HiddenField.cs
- GraphicsPathIterator.cs
- precedingsibling.cs
- UriParserTemplates.cs
- SafePEFileHandle.cs
- ListenerAdaptersInstallComponent.cs
- Classification.cs
- ExceptionValidationRule.cs
- FilteredDataSetHelper.cs
- WebControlAdapter.cs
- _CacheStreams.cs
- PropertyDescriptor.cs
- CdpEqualityComparer.cs
- ToolboxItemAttribute.cs
- ExpressionSelection.cs
- DefaultPropertyAttribute.cs
- RegistryConfigurationProvider.cs
- MimeImporter.cs
- GACMembershipCondition.cs
- FloaterBaseParagraph.cs
- DataPagerFieldItem.cs
- ThemeableAttribute.cs
- ReaderWriterLock.cs
- DataObject.cs
- JavaScriptObjectDeserializer.cs
- StringFunctions.cs
- NativeCompoundFileAPIs.cs
- Section.cs
- DataSourceViewSchemaConverter.cs
- Array.cs
- cookiecontainer.cs
- OracleColumn.cs
- Metafile.cs
- WizardStepBase.cs
- DataBoundControlHelper.cs
- Events.cs
- DataServiceConfiguration.cs
- PointCollection.cs
- Menu.cs
- ImageBrush.cs
- _NestedSingleAsyncResult.cs
- CombinedGeometry.cs
- XamlParser.cs