Skip to content

Commit

Permalink
OpenFolderDialog (#7244)
Browse files Browse the repository at this point in the history
* OpenFolderDialog

* Multiselect and FileNames for folders

* SRID deprecation

* API review update - private protected ctros

* API review update - FolderNames

* FileOk event disunification

* comments update

* FileNames -> ItemNames

* removed duplicate SetFileName call

* move FORCEFILESYSTEM into Initialize

* keep RestoreDirectory in FileDialog

* common dialogs ToString()

* Updated ref assemblies and api compat baseline

---------

Co-authored-by: Jan Kučera <miloush@users.noreply.github.com>
Co-authored-by: dipeshmsft <dipeshkumar@microsoft.com>
  • Loading branch information
3 people committed Jul 7, 2023
1 parent c62ef04 commit f068d67
Show file tree
Hide file tree
Showing 25 changed files with 1,354 additions and 1,923 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
Compat issues with assembly PresentationFramework:
CannotSealType : Type 'Microsoft.Win32.FileDialog' is effectively (has a private constructor) sealed in the implementation but not sealed in the contract.
MembersMustExist : Member 'protected void Microsoft.Win32.FileDialog..ctor()' does not exist in the implementation but it does exist in the contract.
CannotMakeMemberNonVirtual : Member 'public System.Boolean Microsoft.Win32.FileDialog.CheckFileExists' is non-virtual in the implementation but is virtual in the contract.
CannotMakeMemberNonVirtual : Member 'public System.Boolean Microsoft.Win32.FileDialog.CheckFileExists.get()' is non-virtual in the implementation but is virtual in the contract.
CannotMakeMemberNonVirtual : Member 'public void Microsoft.Win32.FileDialog.CheckFileExists.set(System.Boolean)' is non-virtual in the implementation but is virtual in the contract.
MembersMustExist : Member 'internal MS.Internal.AppModel.IFileDialog Microsoft.Win32.FileDialog.CreateVistaDialog()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'protected void Microsoft.Win32.FileDialog.OnFileOk(System.ComponentModel.CancelEventArgs)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'protected System.Int32 Microsoft.Win32.FileDialog.Options.get()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'internal System.String[] Microsoft.Win32.FileDialog.ProcessVistaFiles(MS.Internal.AppModel.IFileDialog)' does not exist in the implementation but it does exist in the contract.
CannotMakeMemberNonVirtual : Member 'public void Microsoft.Win32.FileDialog.Reset()' is non-virtual in the implementation but is virtual in the contract.
MembersMustExist : Member 'internal System.Boolean Microsoft.Win32.FileDialog.RunFileDialog(MS.Win32.NativeMethods.OPENFILENAME_I)' does not exist in the implementation but it does exist in the contract.
CannotMakeMemberNonVirtual : Member 'public System.String Microsoft.Win32.FileDialog.ToString()' is non-virtual in the implementation but is virtual in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Windows.AttachedPropertyBrowsableForChildrenAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract.
MembersMustExist : Member 'internal void System.Windows.FrameworkTemplate.SetTargetTypeInternal(System.Type)' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Windows.ResourceReferenceKeyNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract.
Expand All @@ -24,4 +33,4 @@ TypesMustExist : Type 'System.Windows.Interop.DocObjHost' does not exist in the
CannotRemoveAttribute : Attribute 'System.ComponentModel.TypeConverterAttribute' exists on 'System.Windows.Markup.StaticExtension' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ComponentModel.TypeConverterAttribute' exists on 'System.Windows.Markup.TypeExtension' in the contract but not the implementation.
CannotRemoveBaseTypeOrInterface : Type 'System.Windows.Markup.XamlParseException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract.
Total Issues: 25
Total Issues: 34
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
Compat issues with assembly PresentationFramework:
MembersMustExist : Member 'internal MS.Internal.AppModel.IFileDialog Microsoft.Win32.FileDialog.CreateVistaDialog()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'internal System.String[] Microsoft.Win32.FileDialog.ProcessVistaFiles(MS.Internal.AppModel.IFileDialog)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'internal System.Boolean Microsoft.Win32.FileDialog.RunFileDialog(MS.Win32.NativeMethods.OPENFILENAME_I)' does not exist in the implementation but it does exist in the contract.
CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.ComponentModel.DesignerProperties.GetIsInDesignMode(System.Windows.DependencyObject)' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Windows.AttachedPropertyBrowsableForChildrenAttribute' changed from '[AttributeUsageAttribute(64, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple=false)]' in the implementation.
CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.DataTemplate.Triggers' changed from '[DesignerSerializationVisibilityAttribute(2)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]' in the implementation.
Expand Down Expand Up @@ -264,4 +261,4 @@ CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVi
CannotChangeAttribute : Attribute 'System.Windows.Markup.DesignerSerializationOptionsAttribute' on 'System.Windows.Markup.XmlAttributeProperties.GetXmlSpace(System.Windows.DependencyObject)' changed from '[DesignerSerializationOptionsAttribute(1)]' in the contract to '[DesignerSerializationOptionsAttribute(DesignerSerializationOptions.SerializeAsAttribute)]' in the implementation.
CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.Media.Animation.Storyboard.GetTarget(System.Windows.DependencyObject)' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation.
CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Shapes.Shape' changed from '[LocalizabilityAttribute(0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)]' in the implementation.
Total Issues: 265
Total Issues: 262
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,36 @@ protected virtual void CheckPermissionsToShowDialog() { }
public virtual System.Nullable<bool> ShowDialog() { throw null; }
public System.Nullable<bool> ShowDialog(System.Windows.Window owner) { throw null; }
}
public abstract partial class FileDialog : Microsoft.Win32.CommonDialog
public abstract partial class CommonItemDialog : Microsoft.Win32.CommonDialog
{
protected FileDialog() { }
private protected CommonItemDialog() { }
public System.Collections.Generic.IList<Microsoft.Win32.FileDialogCustomPlace> CustomPlaces { get { throw null; } set { } }
public bool DereferenceLinks { get { throw null; } set { } }
public string InitialDirectory { get { throw null; } set { } }
public string Title { get { throw null; } set { } }
public bool ValidateNames { get { throw null; } set { } }
protected virtual void OnItemOk(System.ComponentModel.CancelEventArgs e) { }
protected override bool RunDialog(System.IntPtr hwndOwner) { throw null; }
public override void Reset() { }
public override string ToString() { throw null; }
}
public abstract partial class FileDialog : Microsoft.Win32.CommonItemDialog
{
private protected FileDialog() { }
public bool AddExtension { get { throw null; } set { } }
public virtual bool CheckFileExists { get { throw null; } set { } }
public bool CheckFileExists { get { throw null; } set { } }
public bool CheckPathExists { get { throw null; } set { } }
public System.Collections.Generic.IList<Microsoft.Win32.FileDialogCustomPlace> CustomPlaces { get { throw null; } set { } }
public string DefaultExt { get { throw null; } set { } }
public bool DereferenceLinks { get { throw null; } set { } }
public string FileName { get { throw null; } set { } }
public string[] FileNames { get { throw null; } }
public event System.ComponentModel.CancelEventHandler FileOk { add { } remove { } }
public string Filter { get { throw null; } set { } }
public int FilterIndex { get { throw null; } set { } }
public string InitialDirectory { get { throw null; } set { } }
protected int Options { get { throw null; } }
protected override void OnItemOk(System.ComponentModel.CancelEventArgs e) { }
public override void Reset() { }
public bool RestoreDirectory { get { throw null; } set { } }
public string SafeFileName { get { throw null; } }
public string[] SafeFileNames { get { throw null; } }
public string Title { get { throw null; } set { } }
public bool ValidateNames { get { throw null; } set { } }
public event System.ComponentModel.CancelEventHandler FileOk { add { } remove { } }
protected override System.IntPtr HookProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) { throw null; }
protected void OnFileOk(System.ComponentModel.CancelEventArgs e) { }
public override void Reset() { }
protected override bool RunDialog(System.IntPtr hwndOwner) { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class FileDialogCustomPlace
Expand Down Expand Up @@ -76,12 +81,24 @@ public sealed partial class OpenFileDialog : Microsoft.Win32.FileDialog
{
public OpenFileDialog() { }
public bool Multiselect { get { throw null; } set { } }
public bool ReadOnlyChecked { get { throw null; } set { } }
public bool ShowReadOnly { get { throw null; } set { } }
protected override void CheckPermissionsToShowDialog() { }
public System.IO.Stream OpenFile() { throw null; }
public System.IO.Stream[] OpenFiles() { throw null; }
public bool ReadOnlyChecked { get { throw null; } set { } }
public override void Reset() { }
public bool ShowReadOnly { get { throw null; } set { } }
}
public sealed partial class OpenFolderDialog : Microsoft.Win32.CommonItemDialog
{
public OpenFolderDialog() { }
public string FolderName { get { throw null; } set { } }
public string[] FolderNames { get { throw null; } }
public event System.ComponentModel.CancelEventHandler FolderOk { add { } remove { } }
public bool Multiselect { get { throw null; } set { } }
protected override void OnItemOk(System.ComponentModel.CancelEventArgs e) { }
public override void Reset() { }
public string SafeFolderName { get { throw null; } }
public string[] SafeFolderNames { get { throw null; } }
public override string ToString() { throw null; }
}
public sealed partial class SaveFileDialog : Microsoft.Win32.FileDialog
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public object Tag
//---------------------------------------------------
#region Protected Methods


// This method is not used by IFileDialog API. Kept for compatibility as CommonDialog can be derived from.
/// <summary>
/// Defines the common dialog box hook procedure that is overridden to
/// add specific functionality to a common dialog box.
Expand Down Expand Up @@ -275,13 +275,12 @@ protected virtual void CheckPermissionsToShowDialog()
//---------------------------------------------------
#region Internal Methods

// This method is not used by IFileDialog API. Kept for compatibility (see HookProc).
/// <summary>
/// Centers the given window on the screen. This method is used by HookProc
/// to center the dialog on the screen before it is shown. We can't mark it
/// private because we need to call it from our derived classes like
/// FileDialog.
/// to center the dialog on the screen before it is shown.
/// </summary>
internal void MoveToScreenCenter(HandleRef hWnd)
private void MoveToScreenCenter(HandleRef hWnd)
{
// Create an IntPtr to store a handle to the monitor.
IntPtr hMonitor = IntPtr.Zero;
Expand Down Expand Up @@ -343,9 +342,8 @@ internal void MoveToScreenCenter(HandleRef hWnd)
// Internal Properties
//
//---------------------------------------------------
#region Internal Properties

#endregion Internal Properties
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
Expand Down
Loading

0 comments on commit f068d67

Please sign in to comment.