-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Add GraphicalHost assembly to enable Out-GridView, Show-Command, and Get-Help -ShowWindow #10899
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
Merged
adityapatwardhan
merged 23 commits into
PowerShell:master
from
SteveL-MSFT:graphicalhost
Nov 1, 2019
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b4e6ada
add GraphicalHost
SteveL-MSFT a7283b4
update copyright notice, move files to folder with namespace name not…
SteveL-MSFT bbdf1eb
fix path names to resources
SteveL-MSFT 2f10f5e
enable generation of public resources needed by show-command
SteveL-MSFT 710918a
remove timeout for ogv window
SteveL-MSFT ed9ff12
fix some style issues
SteveL-MSFT a457c4f
remove reference to workflow
SteveL-MSFT e559a8c
add attribute indicating where the resource dictionary is located
SteveL-MSFT b61795c
fix show-command by removing workflow type and added back -showwindow…
SteveL-MSFT 87c48e9
fix CodeFactor style issues
SteveL-MSFT d2ce8a7
fix default commands test
SteveL-MSFT 30a4c97
codefactor: space after `if` and remove multiple newlines
SteveL-MSFT a3f413a
more codefactor fixes and ConfirmImpact test fix
SteveL-MSFT 8d1d13e
more codefactor fixes
SteveL-MSFT c9a149b
files.wxs update, more codefactor fixes
SteveL-MSFT 425d3f9
fix win-arm build
SteveL-MSFT 43de95c
codefactor fixes
SteveL-MSFT 3f2add5
sort using directives
SteveL-MSFT 4b9510c
add copyright header
SteveL-MSFT df23970
update fwlink
SteveL-MSFT 5f34e80
update help test
SteveL-MSFT 60dd857
update show-command fwlink
SteveL-MSFT b619630
Merge branch 'master' of github.com:PowerShell/PowerShell into graphi…
SteveL-MSFT 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Windows; | ||
|
|
||
| // Specifies the location in which theme dictionaries are stored for types in an assembly. | ||
| [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] | ||
|
|
||
| namespace Microsoft.Management.UI | ||
| { | ||
| /// <summary> | ||
| /// Utilities in common in this assembly | ||
| /// </summary> | ||
| internal static class CommonHelper | ||
| { | ||
| /// <summary> | ||
| /// Restore the values from the settings to the actual window position, size and state. | ||
| /// </summary> | ||
| /// <param name="target">the window we are setting position and size of</param> | ||
| /// <param name="userSettingTop">the value for top from the user settings</param> | ||
| /// <param name="userSettingLeft">the value for left from the user settings</param> | ||
| /// <param name="userSettingWidth">the value for width from the user settings</param> | ||
| /// <param name="userSettingHeight">the value for height from the user settings</param> | ||
| /// <param name="defaultWidth">the with used if <paramref name="userSettingWidth"/> is not valid</param> | ||
| /// <param name="defaultHeight">the height used if <paramref name="userSettingHeight"/> is not valid</param> | ||
| /// <param name="userSettingMaximized">true if the window is maximized in the user setting</param> | ||
| internal static void SetStartingPositionAndSize(Window target, double userSettingTop, double userSettingLeft, double userSettingWidth, double userSettingHeight, double defaultWidth, double defaultHeight, bool userSettingMaximized) | ||
| { | ||
| bool leftInvalid = userSettingLeft < System.Windows.SystemParameters.VirtualScreenLeft || | ||
| userSettingWidth > System.Windows.SystemParameters.VirtualScreenLeft + | ||
| System.Windows.SystemParameters.VirtualScreenWidth; | ||
|
|
||
| bool topInvalid = userSettingTop < System.Windows.SystemParameters.VirtualScreenTop || | ||
| userSettingTop > System.Windows.SystemParameters.VirtualScreenTop + | ||
| System.Windows.SystemParameters.VirtualScreenHeight; | ||
|
|
||
| bool widthInvalid = userSettingWidth < 0 || | ||
| userSettingWidth > System.Windows.SystemParameters.VirtualScreenWidth; | ||
|
|
||
| bool heightInvalid = userSettingHeight < 0 || | ||
| userSettingHeight > System.Windows.SystemParameters.VirtualScreenHeight; | ||
|
|
||
| if (leftInvalid || topInvalid) | ||
| { | ||
| target.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; | ||
| } | ||
| else | ||
| { | ||
| target.Left = userSettingLeft; | ||
| target.Top = userSettingTop; | ||
| } | ||
|
|
||
| // If any saved coordinate is invalid, we set the window to the default position | ||
| if (widthInvalid || heightInvalid) | ||
| { | ||
| target.Width = defaultWidth; | ||
| target.Height = defaultHeight; | ||
| } | ||
| else | ||
| { | ||
| target.Width = userSettingWidth; | ||
| target.Height = userSettingHeight; | ||
| } | ||
|
|
||
| if (userSettingMaximized) | ||
| { | ||
| target.WindowState = WindowState.Maximized; | ||
| } | ||
| } | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.