- Notifications
You must be signed in to change notification settings - Fork 1.2k
UIAutomation: ITransformPattern2 #10953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dotMorten wants to merge 4 commits into dotnet:main Choose a base branch from dotMorten:dotMorten/AddTransformPattern2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
178 changes: 178 additions & 0 deletions 178 ...osoft.DotNet.Wpf/src/PresentationCore/MS/internal/Automation/TransformProvider2Wrapper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| | ||
| // | ||
| // | ||
| // | ||
| // Description: Transform pattern provider wrapper for WCP | ||
| // | ||
| // | ||
| | ||
| using System; | ||
| using System.Windows.Threading; | ||
| using System.Windows.Media; | ||
| using System.Windows.Automation; | ||
| using System.Windows.Automation.Provider; | ||
| using System.Windows.Automation.Peers; | ||
| | ||
| namespace MS.Internal.Automation | ||
| { | ||
| // Automation/WCP Wrapper class: Implements that UIAutomation I...Provider | ||
| // interface, and calls through to a WCP AutomationPeer which implements the corresponding | ||
| // I...Provider inteface. Marshalls the call from the RPC thread onto the | ||
| // target AutomationPeer's context. | ||
| // | ||
| // Class has two major parts to it: | ||
| // * Implementation of the I...Provider, which uses Dispatcher.Invoke | ||
| // to call a private method (lives in second half of the class) via a delegate, | ||
| // if necessary, packages any params into an object param. Return type of Invoke | ||
| // must be cast from object to appropriate type. | ||
| // * private methods - one for each interface entry point - which get called back | ||
| // on the right context. These call through to the peer that's actually | ||
| // implenting the I...Provider version of the interface. | ||
| internal class TransformProvider2Wrapper: TransformProviderWrapper, ITransformProvider2 | ||
| { | ||
| //------------------------------------------------------ | ||
| // | ||
| // Constructors | ||
| // | ||
| //------------------------------------------------------ | ||
| | ||
| #region Constructors | ||
| | ||
| private TransformProvider2Wrapper( AutomationPeer peer, ITransformProvider2 iface ) : base(peer, iface) | ||
| { | ||
| _peer = peer; | ||
| _iface = iface; | ||
| } | ||
| | ||
| #endregion Constructors | ||
| | ||
| | ||
| //------------------------------------------------------ | ||
| // | ||
| // Interface IWindowProvider | ||
| // | ||
| //------------------------------------------------------ | ||
| | ||
| #region Interface ITransformProvider2 | ||
| | ||
| | ||
| public void Zoom( double zoomAmount ) | ||
| { | ||
| ElementUtil.Invoke( _peer, new DispatcherOperationCallback( Zoom ), zoomAmount ); | ||
| } | ||
| | ||
| public void ZoomByUnit( ZoomUnit zoomUnit ) | ||
| { | ||
| ElementUtil.Invoke( _peer, new DispatcherOperationCallback( ZoomByUnit ), zoomUnit ); | ||
| } | ||
| | ||
| public bool CanZoom | ||
| { | ||
| get | ||
| { | ||
| return (bool) ElementUtil.Invoke( _peer, new DispatcherOperationCallback( GetCanZoom ), null ); | ||
| } | ||
| } | ||
| | ||
| public double ZoomLevel | ||
| { | ||
| get | ||
| { | ||
| return (double) ElementUtil.Invoke( _peer, new DispatcherOperationCallback( GetZoomLevel ), null ); | ||
| } | ||
| } | ||
| | ||
| public double ZoomMinimum | ||
| { | ||
| get | ||
| { | ||
| return (double) ElementUtil.Invoke( _peer, new DispatcherOperationCallback(GetZoomMinimum ), null ); | ||
| } | ||
| } | ||
| | ||
| | ||
| public double ZoomMaximum | ||
| { | ||
| get | ||
| { | ||
| return (double)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetZoomMaximum), null); | ||
| } | ||
| } | ||
| | ||
| #endregion Interface ITransformProvider2 | ||
| | ||
| | ||
| //------------------------------------------------------ | ||
| // | ||
| // Internal Methods | ||
| // | ||
| //------------------------------------------------------ | ||
| | ||
| #region Internal Methods | ||
| | ||
| internal static new object Wrap( AutomationPeer peer, object iface ) | ||
| { | ||
| return new TransformProvider2Wrapper( peer, (ITransformProvider2) iface ); | ||
| } | ||
| | ||
| #endregion Internal Methods | ||
| | ||
| //------------------------------------------------------ | ||
| // | ||
| // Private Methods | ||
| // | ||
| //------------------------------------------------------ | ||
| | ||
| #region Private Methods | ||
| | ||
| private object Zoom( object arg ) | ||
| { | ||
| _iface.Zoom( (double)arg ); | ||
| return null; | ||
| } | ||
| | ||
| private object ZoomByUnit( object arg ) | ||
| { | ||
| _iface.ZoomByUnit( (ZoomUnit)arg ); | ||
| return null; | ||
| } | ||
| | ||
| private object GetCanZoom( object unused ) | ||
| { | ||
| return _iface.CanZoom; | ||
| } | ||
| | ||
| private object GetZoomLevel( object unused ) | ||
| { | ||
| return _iface.ZoomLevel; | ||
| } | ||
| | ||
| private object GetZoomMinimum( object unused ) | ||
| { | ||
| return _iface.ZoomMinimum; | ||
| } | ||
| | ||
| private object GetZoomMaximum(object unused) | ||
| { | ||
| return _iface.ZoomMaximum; | ||
| } | ||
| | ||
| #endregion Private Methods | ||
| | ||
| | ||
| //------------------------------------------------------ | ||
| // | ||
| // Private Fields | ||
| // | ||
| //------------------------------------------------------ | ||
| | ||
| #region Private Fields | ||
| | ||
| private AutomationPeer _peer; | ||
| private ITransformProvider2 _iface; | ||
| | ||
| #endregion Private Fields | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintended change?