Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Automation / SynchronizedInputAdaptor.cs / 1305600 / SynchronizedInputAdaptor.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Synchronized Input pattern adaptor // History: // 07/28/2009 : [....] - created // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Provider; using MS.Internal; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace MS.Internal.Automation { ////// Represents a synchronized input provider that supports the synchronized input pattern across /// UIElements, ContentElements and UIElement3D. /// internal class SynchronizedInputAdaptor : ISynchronizedInputProvider { ////// Constructor /// /// UIElement or ContentElement or UIElement3D this adaptor is associated with. internal SynchronizedInputAdaptor(DependencyObject owner) { Invariant.Assert(owner != null); _owner = owner; } ////// This method is called by automation framework to trigger synchronized input processing. /// /// Synchronized input type void ISynchronizedInputProvider.StartListening(SynchronizedInputType inputType) { UIElement e = _owner as UIElement; if (e != null) { if (!e.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } else { ContentElement ce = _owner as ContentElement; if (ce != null) { if (!ce.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } else { UIElement3D e3D = (UIElement3D)_owner; if (!e3D.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } } } /////// Cancel synchronized input processing. /// void ISynchronizedInputProvider.Cancel() { UIElement e = _owner as UIElement; if (e != null) { e.CancelSynchronizedInput(); } else { ContentElement ce = _owner as ContentElement; if (ce != null) { ce.CancelSynchronizedInput(); } else { UIElement3D e3D = (UIElement3D)_owner; e3D.CancelSynchronizedInput(); } } } private readonly DependencyObject _owner; } } // 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. // // // // Description: Synchronized Input pattern adaptor // History: // 07/28/2009 : [....] - created // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Provider; using MS.Internal; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace MS.Internal.Automation { ////// Represents a synchronized input provider that supports the synchronized input pattern across /// UIElements, ContentElements and UIElement3D. /// internal class SynchronizedInputAdaptor : ISynchronizedInputProvider { ////// Constructor /// /// UIElement or ContentElement or UIElement3D this adaptor is associated with. internal SynchronizedInputAdaptor(DependencyObject owner) { Invariant.Assert(owner != null); _owner = owner; } ////// This method is called by automation framework to trigger synchronized input processing. /// /// Synchronized input type void ISynchronizedInputProvider.StartListening(SynchronizedInputType inputType) { UIElement e = _owner as UIElement; if (e != null) { if (!e.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } else { ContentElement ce = _owner as ContentElement; if (ce != null) { if (!ce.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } else { UIElement3D e3D = (UIElement3D)_owner; if (!e3D.StartListeningSynchronizedInput(inputType)) { throw new InvalidOperationException(SR.Get(SRID.Automation_RecursivePublicCall)); } } } } /////// Cancel synchronized input processing. /// void ISynchronizedInputProvider.Cancel() { UIElement e = _owner as UIElement; if (e != null) { e.CancelSynchronizedInput(); } else { ContentElement ce = _owner as ContentElement; if (ce != null) { ce.CancelSynchronizedInput(); } else { UIElement3D e3D = (UIElement3D)_owner; e3D.CancelSynchronizedInput(); } } } private readonly DependencyObject _owner; } } // 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
- DiffuseMaterial.cs
- MetadataItem_Static.cs
- StructuralType.cs
- TagPrefixAttribute.cs
- SchemaElementDecl.cs
- HttpInputStream.cs
- UnsafeNativeMethods.cs
- RuleDefinitions.cs
- TypeConverterHelper.cs
- Instrumentation.cs
- _DigestClient.cs
- Blend.cs
- StreamSecurityUpgradeInitiator.cs
- Literal.cs
- RC2CryptoServiceProvider.cs
- TextStore.cs
- ContextMenuStrip.cs
- TemplateParser.cs
- VolatileResourceManager.cs
- PrtTicket_Base.cs
- DataSourceXmlElementAttribute.cs
- Comparer.cs
- TextClipboardData.cs
- ToolStripAdornerWindowService.cs
- Thumb.cs
- AutoGeneratedFieldProperties.cs
- Double.cs
- HtmlUtf8RawTextWriter.cs
- XmlSchemaComplexContent.cs
- TemplateAction.cs
- HiddenField.cs
- StreamMarshaler.cs
- ReadOnlyDictionary.cs
- CollectionViewGroup.cs
- storepermission.cs
- DataGridTablesFactory.cs
- PolyLineSegment.cs
- XmlCodeExporter.cs
- TextElement.cs
- MaskedTextBox.cs
- XhtmlBasicPanelAdapter.cs
- DataTemplate.cs
- WebPartCancelEventArgs.cs
- DrawingServices.cs
- ThreadExceptionEvent.cs
- WindowShowOrOpenTracker.cs
- XmlPropertyBag.cs
- WriteFileContext.cs
- SimpleApplicationHost.cs
- AsyncStreamReader.cs
- DomNameTable.cs
- ConnectionsZone.cs
- GPPOINT.cs
- IItemContainerGenerator.cs
- EditorPart.cs
- FlowDocumentPage.cs
- DbConvert.cs
- ExceptionRoutedEventArgs.cs
- Window.cs
- ChangeProcessor.cs
- DataObjectFieldAttribute.cs
- DataGridViewToolTip.cs
- HighContrastHelper.cs
- OrthographicCamera.cs
- CommonXSendMessage.cs
- DesignObjectWrapper.cs
- BevelBitmapEffect.cs
- DefaultShape.cs
- Selection.cs
- Int32.cs
- DataGridPageChangedEventArgs.cs
- ArraySet.cs
- VBCodeProvider.cs
- SynchronousChannelMergeEnumerator.cs
- TerminateWorkflow.cs
- OleDbPermission.cs
- UIPropertyMetadata.cs
- WindowsFormsLinkLabel.cs
- UnsafeNativeMethods.cs
- ForeignConstraint.cs
- EncodingInfo.cs
- StaticDataManager.cs
- TextCompositionManager.cs
- DataFieldConverter.cs
- GridViewColumnHeader.cs
- LayoutEditorPart.cs
- securitycriticaldataformultiplegetandset.cs
- UnconditionalPolicy.cs
- HtmlInputHidden.cs
- MobileTemplatedControlDesigner.cs
- ToolStripContainerDesigner.cs
- MethodImplAttribute.cs
- MetadataCache.cs
- RegexParser.cs
- ErrorEventArgs.cs
- QilParameter.cs
- ResourcePool.cs
- MinimizableAttributeTypeConverter.cs
- ContentWrapperAttribute.cs
- ScrollChrome.cs