Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / MS / Internal / Automation / TextProviderWrapper.cs / 1 / TextProviderWrapper.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Text pattern provider wrapper for WCP // // History: // 03/09/2004 : a-davidj created. // //--------------------------------------------------------------------------- using System; using System.Windows.Threading; using System.Windows; using System.Windows.Media; using System.Windows.Automation; using System.Windows.Automation.Provider; using System.Windows.Automation.Text; using System.Windows.Automation.Peers; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace MS.Internal.Automation { // see comment on InvokeProviderWrapper class for explanation of purpose and organization of these wrapper classes. internal class TextProviderWrapper : MarshalByRefObject, ITextProvider { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors private TextProviderWrapper( AutomationPeer peer, ITextProvider iface ) { _peer = peer; _iface = iface; } #endregion Constructors //------------------------------------------------------ // // Interface ITextProvider // //----------------------------------------------------- #region Interface ITextProvider public ITextRangeProvider [] GetSelection() { return (ITextRangeProvider [])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSelection), null); } public ITextRangeProvider [] GetVisibleRanges() { return (ITextRangeProvider[])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetVisibleRanges), null); } public ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement) { if (!(childElement is ElementProxy)) { throw new ArgumentException(SR.Get(SRID.TextProvider_InvalidChild, "childElement")); } return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromChild), childElement); } public ITextRangeProvider RangeFromPoint(Point screenLocation) { return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromPoint), screenLocation); } public ITextRangeProvider DocumentRange { get { return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetDocumentRange), null); } } public SupportedTextSelection SupportedTextSelection { get { return (SupportedTextSelection)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSupportedTextSelection), null); } } #endregion Interface ITextProvider //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods internal static object Wrap( AutomationPeer peer, object iface ) { return new TextProviderWrapper( peer, (ITextProvider) iface ); } #endregion Internal Methods //----------------------------------------------------- // // Private Methods // //------------------------------------------------------ #region Private Methods private object GetSelection(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.GetSelection(), _peer ); } private object GetVisibleRanges(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.GetVisibleRanges(), _peer ); } private object RangeFromChild(object arg) { IRawElementProviderSimple childElement = (IRawElementProviderSimple)arg; return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromChild(childElement), _peer ); } private object RangeFromPoint(object arg) { Point screenLocation = (Point)arg; return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromPoint(screenLocation), _peer ); } private object GetDocumentRange(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.DocumentRange, _peer ); } private object GetSupportedTextSelection(object unused) { return _iface.SupportedTextSelection; } #endregion Private Methods //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields private AutomationPeer _peer; private ITextProvider _iface; #endregion Private Fields } } // 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: Text pattern provider wrapper for WCP // // History: // 03/09/2004 : a-davidj created. // //--------------------------------------------------------------------------- using System; using System.Windows.Threading; using System.Windows; using System.Windows.Media; using System.Windows.Automation; using System.Windows.Automation.Provider; using System.Windows.Automation.Text; using System.Windows.Automation.Peers; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace MS.Internal.Automation { // see comment on InvokeProviderWrapper class for explanation of purpose and organization of these wrapper classes. internal class TextProviderWrapper : MarshalByRefObject, ITextProvider { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors private TextProviderWrapper( AutomationPeer peer, ITextProvider iface ) { _peer = peer; _iface = iface; } #endregion Constructors //------------------------------------------------------ // // Interface ITextProvider // //----------------------------------------------------- #region Interface ITextProvider public ITextRangeProvider [] GetSelection() { return (ITextRangeProvider [])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSelection), null); } public ITextRangeProvider [] GetVisibleRanges() { return (ITextRangeProvider[])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetVisibleRanges), null); } public ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement) { if (!(childElement is ElementProxy)) { throw new ArgumentException(SR.Get(SRID.TextProvider_InvalidChild, "childElement")); } return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromChild), childElement); } public ITextRangeProvider RangeFromPoint(Point screenLocation) { return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromPoint), screenLocation); } public ITextRangeProvider DocumentRange { get { return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetDocumentRange), null); } } public SupportedTextSelection SupportedTextSelection { get { return (SupportedTextSelection)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSupportedTextSelection), null); } } #endregion Interface ITextProvider //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods internal static object Wrap( AutomationPeer peer, object iface ) { return new TextProviderWrapper( peer, (ITextProvider) iface ); } #endregion Internal Methods //----------------------------------------------------- // // Private Methods // //------------------------------------------------------ #region Private Methods private object GetSelection(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.GetSelection(), _peer ); } private object GetVisibleRanges(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.GetVisibleRanges(), _peer ); } private object RangeFromChild(object arg) { IRawElementProviderSimple childElement = (IRawElementProviderSimple)arg; return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromChild(childElement), _peer ); } private object RangeFromPoint(object arg) { Point screenLocation = (Point)arg; return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromPoint(screenLocation), _peer ); } private object GetDocumentRange(object unused) { return TextRangeProviderWrapper.WrapArgument( _iface.DocumentRange, _peer ); } private object GetSupportedTextSelection(object unused) { return _iface.SupportedTextSelection; } #endregion Private Methods //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields private AutomationPeer _peer; private ITextProvider _iface; #endregion Private Fields } } // 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
- WmiEventSink.cs
- DataMisalignedException.cs
- OracleBinary.cs
- XPathSelfQuery.cs
- StrongNameIdentityPermission.cs
- ListQueryResults.cs
- HttpProfileGroupBase.cs
- PrimitiveXmlSerializers.cs
- XmlArrayAttribute.cs
- ModuleBuilderData.cs
- XPathNodePointer.cs
- Signature.cs
- ParallelTimeline.cs
- GridViewDeletedEventArgs.cs
- NetworkStream.cs
- AffineTransform3D.cs
- RepeaterCommandEventArgs.cs
- PrimarySelectionAdorner.cs
- LinqDataSourceDeleteEventArgs.cs
- GenericUriParser.cs
- securitycriticaldataClass.cs
- UrlMappingsSection.cs
- IdentityModelStringsVersion1.cs
- DataGridViewLayoutData.cs
- DropSource.cs
- ClientSettingsProvider.cs
- UdpUtility.cs
- SqlLiftWhereClauses.cs
- XamlToRtfParser.cs
- NegotiationTokenAuthenticatorState.cs
- Image.cs
- PageAdapter.cs
- DirectionalLight.cs
- XPathParser.cs
- DocumentOrderQuery.cs
- WebPartZone.cs
- DbConnectionPool.cs
- ColorAnimationUsingKeyFrames.cs
- Util.cs
- EdmTypeAttribute.cs
- SiteMapDataSourceView.cs
- WebPartConnectionsCancelVerb.cs
- DesignTimeParseData.cs
- TextEditorCharacters.cs
- GeometryHitTestParameters.cs
- ParseHttpDate.cs
- DataControlFieldCell.cs
- ValidatedControlConverter.cs
- NetNamedPipeSecurityElement.cs
- WebBrowser.cs
- MultipartIdentifier.cs
- ListBindingConverter.cs
- WindowsImpersonationContext.cs
- TypeLibConverter.cs
- NamespaceList.cs
- Random.cs
- EventManager.cs
- ProcessInputEventArgs.cs
- SoapAttributeAttribute.cs
- WindowsFormsSectionHandler.cs
- DetailsViewInsertedEventArgs.cs
- HttpHandler.cs
- SqlVisitor.cs
- XhtmlBasicSelectionListAdapter.cs
- FixedSOMImage.cs
- UserPreferenceChangingEventArgs.cs
- RegistrationProxy.cs
- MenuRendererStandards.cs
- DateTimeFormat.cs
- BlobPersonalizationState.cs
- IApplicationTrustManager.cs
- WebPartAuthorizationEventArgs.cs
- EncodingStreamWrapper.cs
- ArrayMergeHelper.cs
- BamlResourceDeserializer.cs
- SelectionItemPattern.cs
- QuadraticBezierSegment.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ExtendedPropertyDescriptor.cs
- FunctionDescription.cs
- SqlCharStream.cs
- FileStream.cs
- OleDbConnection.cs
- IconHelper.cs
- SerializationInfoEnumerator.cs
- DataContractAttribute.cs
- SettingsContext.cs
- InstanceNotReadyException.cs
- TypeGeneratedEventArgs.cs
- PropertyContainer.cs
- SiteMapPath.cs
- HttpCapabilitiesBase.cs
- DockingAttribute.cs
- DataErrorValidationRule.cs
- DirectionalAction.cs
- DelimitedListTraceListener.cs
- GlyphsSerializer.cs
- DocumentViewerBaseAutomationPeer.cs
- SrgsSubset.cs
- OdbcParameterCollection.cs