Skip to content

Commit

Permalink
Port SelectedPathEditor (#2305)
Browse files Browse the repository at this point in the history
Closes #2282
  • Loading branch information
vladimir-krestov authored and RussKie committed Nov 8, 2019
1 parent 0a75d0b commit 636af45
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/System.Design/src/System.Design.Forwards.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -11,6 +11,7 @@
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListViewGroupCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListViewItemCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListViewSubItemCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.SelectedPathEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringArrayEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.TabPageCollectionEditor))]
3 changes: 3 additions & 0 deletions src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,7 @@ Press Ctrl+Enter to accept Text.</value>
<data name="iconFileDescription" xml:space="preserve">
<value>Icon files</value>
</data>
<data name="SelectedPathEditorLabel" xml:space="preserve">
<value>Select the path to the folder that will initially be selected in the FolderBrowserDialog.</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public string Description
public unsafe DialogResult ShowDialog(IWin32Window owner)
{
// Get/find an owner HWND for this dialog
IntPtr hWndOwner = owner == null ? owner.Handle : UnsafeNativeMethods.GetActiveWindow();
IntPtr hWndOwner = owner != null ? owner.Handle : UnsafeNativeMethods.GetActiveWindow();

// Get the IDL for the specific startLocation
Shell32.SHGetSpecialFolderLocation(hWndOwner, (int)StartLocation, out CoTaskMemSafeHandle listHandle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Windows.Forms.Design
{
/// <summary>
/// Folder editor for choosing the initial folder of the folder browser dialog.
/// </summary>
internal class SelectedPathEditor : FolderNameEditor
{
protected override void InitializeDialog(FolderBrowser folderBrowser)
{
folderBrowser.Description = SR.SelectedPathEditorLabel;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -78,7 +78,7 @@ public void EnsureUITypeEditorForType(Type type, Type expectedEditorType)
[InlineData(typeof(DateTimePicker), "Value", typeof(DateTimeEditor))]
[InlineData(typeof(DomainUpDown), "Items", typeof(StringCollectionEditor))]
//[InlineData(typeof(ErrorProvider), "DataMember", typeof(DataMemberListEditor))]
//[InlineData(typeof(FolderBrowserDialog), "SelectedPath", typeof(SelectedPathEditor))]
[InlineData(typeof(FolderBrowserDialog), "SelectedPath", typeof(SelectedPathEditor))]
//[InlineData(typeof(HelpProvider), "HelpNamespace", typeof(HelpNamespaceEditor))]
[InlineData(typeof(Label), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(Label), "ImageKey", typeof(ImageIndexEditor))]
Expand Down

0 comments on commit 636af45

Please sign in to comment.