-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from NetlifeBackupSolutions/olevegard/appbar
Changed click in Winium.StoreApps
- Loading branch information
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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
44 changes: 44 additions & 0 deletions
44
Winium/Winium.StoreApps.InnerServer/Commands/ClickCommand.cs
This file contains 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,44 @@ | ||
namespace Winium.StoreApps.InnerServer.Commands | ||
{ | ||
#region | ||
|
||
using Windows.UI.Xaml.Automation.Peers; | ||
using Windows.UI.Xaml.Automation.Provider; | ||
using Windows.UI.Xaml.Controls; | ||
using Common; | ||
|
||
#endregion | ||
|
||
internal class ClickCommand : CommandBase | ||
{ | ||
#region Public Properties | ||
|
||
public string ElementId { private get; set; } | ||
|
||
#endregion | ||
|
||
#region Public Methods and Operators | ||
|
||
protected override string DoImpl() | ||
{ | ||
var element = this.Automator.ElementsRegistry.GetRegisteredElement(this.ElementId); | ||
Button button = element.Element as Button; | ||
if (button != null) | ||
{ | ||
ButtonAutomationPeer peer = new ButtonAutomationPeer(button); | ||
IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; | ||
if (invokeProv != null) | ||
{ | ||
invokeProv.Invoke(); | ||
return this.JsonResponse(ResponseStatus.Success, ""); | ||
} | ||
|
||
return this.JsonResponse(ResponseStatus.UnknownError, "Failed to create invocation provider : " + this.ElementId); | ||
} | ||
|
||
return this.JsonResponse(ResponseStatus.UnknownError, "Element is not a button" + this.ElementId); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains 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