C# Class Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog

Inheritance: IDialogControlHost, IDisposable
Datei anzeigen Open project: godly-devotion/Baka-MPlayer-old Class Usage Examples

Private Properties

Property Type Description
ApplyNativeSettings void
CalculateNativeDialogOptionFlags ShellNativeMethods.FileOpenOptions
CleanUpNativeFileDialog void
GenerateNotImplementedException void
GetCustomizedFileDialog void
GetDerivedOptionFlags ShellNativeMethods.FileOpenOptions
GetFileNameFromShellItem string
GetNativeFileDialog IFileDialog
GetShellItemAt IShellItem
InitializeEventSink void
InitializeNativeFileDialog void
PopulateWithFileNames void
PopulateWithIShellItems void
SyncFileTypeComboToDefaultExtension void

Public Methods

Method Description
AddPlace ( ShellContainer place, FileDialogAddPlaceLocation location ) : void

Adds a location, such as a folder, library, search connector, or known folder, to the list of places available for a user to open or save items. This method actually adds an item to the Favorite Links or Places section of the Open/Save dialog.

AddPlace ( string path, FileDialogAddPlaceLocation location ) : void

Adds a location (folder, library, search connector, known folder) to the list of places available for the user to open or save items. This method actually adds an item to the Favorite Links or Places section of the Open/Save dialog. Overload method takes in a string for the path.

ApplyCollectionChanged ( ) : void

Applies changes to the collection.

ApplyControlPropertyChange ( string propertyName, Microsoft.WindowsAPICodePack.Dialogs.DialogControl control ) : void

Called when a control currently in the collection has a property changed.

Dispose ( ) : void

Releases the resources used by the current instance of the CommonFileDialog class.

IsCollectionChangeAllowed ( ) : bool

Returns if change to the colleciton is allowed.

IsControlPropertyChangeAllowed ( string propertyName, Microsoft.WindowsAPICodePack.Dialogs.DialogControl control ) : bool

Determines if changes to a specific property are allowed.

ResetUserSelections ( ) : void

Removes the current selection.

ShowDialog ( ) : CommonFileDialogResult

Displays the dialog.

ShowDialog ( IntPtr ownerWindowHandle ) : CommonFileDialogResult

Displays the dialog.

ShowDialog ( Window window ) : CommonFileDialogResult

Displays the dialog.

Protected Methods

Method Description
CheckFileItemsAvailable ( ) : void

Ensures that the user has selected one or more files.

CheckFileNamesAvailable ( ) : void

Ensures that the user has selected one or more files.

CommonFileDialog ( ) : System

Creates a new instance of this class.

CommonFileDialog ( string title ) : System

Creates a new instance of this class with the specified title.

Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the CommonFileDialog class and optionally releases the managed resources.

OnFileOk ( CancelEventArgs e ) : void

Raises the CommonFileDialog.FileOk event just before the dialog is about to return with a result.

OnFileTypeChanged ( EventArgs e ) : void

Raises the CommonFileDialog.FileTypeChanged event when the dialog is opened to notify the application of the initial chosen filetype.

OnFolderChanged ( EventArgs e ) : void

Raises the CommonFileDialog.FolderChanged event when the user navigates to a new folder.

OnFolderChanging ( Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFolderChangeEventArgs e ) : void

Raises the FolderChanging to stop navigation to a particular location.

OnOpening ( EventArgs e ) : void

Raises the CommonFileDialog.DialogOpening event when the dialog is opened.

OnSelectionChanged ( EventArgs e ) : void

Raises the CommonFileDialog.SelectionChanged event when the user changes the selection in the dialog's view.

ThrowIfDialogShowing ( string message ) : void

Throws an exception when the dialog is showing preventing a requested change to a property or the visible set of controls.

Private Methods

Method Description
ApplyNativeSettings ( IFileDialog dialog ) : void
CalculateNativeDialogOptionFlags ( ) : ShellNativeMethods.FileOpenOptions
CleanUpNativeFileDialog ( ) : void
GenerateNotImplementedException ( ) : void
GetCustomizedFileDialog ( ) : void

Get the IFileDialogCustomize interface, preparing to add controls.

GetDerivedOptionFlags ( ShellNativeMethods flags ) : ShellNativeMethods.FileOpenOptions
GetFileNameFromShellItem ( IShellItem item ) : string
GetNativeFileDialog ( ) : IFileDialog
GetShellItemAt ( IShellItemArray array, int i ) : IShellItem
InitializeEventSink ( IFileDialog nativeDlg ) : void
InitializeNativeFileDialog ( ) : void
PopulateWithFileNames ( Collection names ) : void
PopulateWithIShellItems ( Collection shellItems ) : void
SyncFileTypeComboToDefaultExtension ( IFileDialog dialog ) : void

Tries to set the File(s) Type Combo to match the value in 'DefaultExtension'. Only doing this if 'this' is a Save dialog as it makes no sense to do this if only Opening a file.

Method Details

AddPlace() public method

Adds a location, such as a folder, library, search connector, or known folder, to the list of places available for a user to open or save items. This method actually adds an item to the Favorite Links or Places section of the Open/Save dialog.
public AddPlace ( ShellContainer place, FileDialogAddPlaceLocation location ) : void
place ShellContainer The item to add to the places list.
location FileDialogAddPlaceLocation One of the enumeration values that indicates placement of the item in the list.
return void

AddPlace() public method

Adds a location (folder, library, search connector, known folder) to the list of places available for the user to open or save items. This method actually adds an item to the Favorite Links or Places section of the Open/Save dialog. Overload method takes in a string for the path.
public AddPlace ( string path, FileDialogAddPlaceLocation location ) : void
path string The item to add to the places list.
location FileDialogAddPlaceLocation One of the enumeration values that indicates placement of the item in the list.
return void

ApplyCollectionChanged() public method

Applies changes to the collection.
public ApplyCollectionChanged ( ) : void
return void

ApplyControlPropertyChange() public method

Called when a control currently in the collection has a property changed.
public ApplyControlPropertyChange ( string propertyName, Microsoft.WindowsAPICodePack.Dialogs.DialogControl control ) : void
propertyName string The name of the property changed.
control Microsoft.WindowsAPICodePack.Dialogs.DialogControl The control whose property has changed.
return void

CheckFileItemsAvailable() protected method

Ensures that the user has selected one or more files.
protected CheckFileItemsAvailable ( ) : void
return void

CheckFileNamesAvailable() protected method

Ensures that the user has selected one or more files.
protected CheckFileNamesAvailable ( ) : void
return void

CommonFileDialog() protected method

Creates a new instance of this class.
protected CommonFileDialog ( ) : System
return System

CommonFileDialog() protected method

Creates a new instance of this class with the specified title.
protected CommonFileDialog ( string title ) : System
title string The title to display in the dialog.
return System

Dispose() public method

Releases the resources used by the current instance of the CommonFileDialog class.
public Dispose ( ) : void
return void

Dispose() protected method

Releases the unmanaged resources used by the CommonFileDialog class and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only unmanaged resources.
return void

IsCollectionChangeAllowed() public method

Returns if change to the colleciton is allowed.
public IsCollectionChangeAllowed ( ) : bool
return bool

IsControlPropertyChangeAllowed() public method

Determines if changes to a specific property are allowed.
public IsControlPropertyChangeAllowed ( string propertyName, Microsoft.WindowsAPICodePack.Dialogs.DialogControl control ) : bool
propertyName string The name of the property.
control Microsoft.WindowsAPICodePack.Dialogs.DialogControl The control propertyName applies to.
return bool

OnFileOk() protected method

Raises the CommonFileDialog.FileOk event just before the dialog is about to return with a result.
protected OnFileOk ( CancelEventArgs e ) : void
e CancelEventArgs The event data.
return void

OnFileTypeChanged() protected method

Raises the CommonFileDialog.FileTypeChanged event when the dialog is opened to notify the application of the initial chosen filetype.
protected OnFileTypeChanged ( EventArgs e ) : void
e System.EventArgs The event data.
return void

OnFolderChanged() protected method

Raises the CommonFileDialog.FolderChanged event when the user navigates to a new folder.
protected OnFolderChanged ( EventArgs e ) : void
e System.EventArgs The event data.
return void

OnFolderChanging() protected method

Raises the FolderChanging to stop navigation to a particular location.
protected OnFolderChanging ( Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFolderChangeEventArgs e ) : void
e Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFolderChangeEventArgs Cancelable event arguments.
return void

OnOpening() protected method

Raises the CommonFileDialog.DialogOpening event when the dialog is opened.
protected OnOpening ( EventArgs e ) : void
e System.EventArgs The event data.
return void

OnSelectionChanged() protected method

Raises the CommonFileDialog.SelectionChanged event when the user changes the selection in the dialog's view.
protected OnSelectionChanged ( EventArgs e ) : void
e System.EventArgs The event data.
return void

ResetUserSelections() public method

Removes the current selection.
public ResetUserSelections ( ) : void
return void

ShowDialog() public method

Displays the dialog.
public ShowDialog ( ) : CommonFileDialogResult
return CommonFileDialogResult

ShowDialog() public method

Displays the dialog.
public ShowDialog ( IntPtr ownerWindowHandle ) : CommonFileDialogResult
ownerWindowHandle System.IntPtr Window handle of any top-level window that will own the modal dialog box.
return CommonFileDialogResult

ShowDialog() public method

Displays the dialog.
public ShowDialog ( Window window ) : CommonFileDialogResult
window System.Windows.Window Top-level WPF window that will own the modal dialog box.
return CommonFileDialogResult

ThrowIfDialogShowing() protected method

Throws an exception when the dialog is showing preventing a requested change to a property or the visible set of controls.
protected ThrowIfDialogShowing ( string message ) : void
message string The message to include in the exception.
return void