本文整理汇总了C#中IFileDialog类的典型用法代码示例。如果您正苦于以下问题:C# IFileDialog类的具体用法?C# IFileDialog怎么用?C# IFileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFileDialog类属于命名空间,在下文中一共展示了IFileDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnFileOk
public HRESULT OnFileOk(IFileDialog pfd)
{
if( _dialog.DoFileOk(pfd) )
return HRESULT.S_OK;
else
return HRESULT.S_FALSE;
}
示例2: OnTypeChange
public void OnTypeChange(IFileDialog pfd)
{
}
示例3: OnSelectionChange
public void OnSelectionChange(IFileDialog pfd)
{
}
示例4: OnFolderChanging
public HRESULT OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
{
return HRESULT.S_OK;
}
示例5: OnOverwrite
public void OnOverwrite(IFileDialog pfd, IShellItem psi, out NativeMethods.FDE_OVERWRITE_RESPONSE pResponse)
{
// TODO: Implement overwrite notification support
pResponse = NativeMethods.FDE_OVERWRITE_RESPONSE.FDEOR_ACCEPT;
}
示例6: OnSelectionChange
public void OnSelectionChange(IFileDialog pfd)
{
parent.OnSelectionChanged(EventArgs.Empty);
}
示例7: OnFolderChanging
public HRESULT OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
{
CommonFileDialogFolderChangeEventArgs args =
new CommonFileDialogFolderChangeEventArgs(parent.GetFileNameFromShellItem(psiFolder));
if (!firstFolderChanged)
parent.OnFolderChanging(args);
return (args.Cancel ? HRESULT.S_FALSE : HRESULT.S_OK);
}
示例8: SyncFileTypeComboToDefaultExtension
/// <summary>
/// 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.
/// </summary>
///
/// <param name="dialog">The native/IFileDialog instance.</param>
///
private void SyncFileTypeComboToDefaultExtension(IFileDialog dialog)
{
if (DefaultExtension == null ||
filters.Count <= 0)
{
return;
}
CommonFileDialogFilter filter = null;
for (uint filtersCounter = 0; filtersCounter < filters.Count; filtersCounter++)
{
filter = (CommonFileDialogFilter)filters[(int)filtersCounter];
if (filter.Extensions.Contains(DefaultExtension))
{
// set the docType combo to match this
// extension. property is a 1-based index.
dialog.SetFileTypeIndex(filtersCounter + 1);
// we're done, exit for
break;
}
}
}
示例9: OnOverwrite
public void OnOverwrite(IFileDialog pfd, IShellItem psi, out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse)
{
// Don't accept or reject the dialog, keep default settings
pResponse = ShellNativeMethods.FileDialogEventOverwriteResponse.Default;
}
示例10: OnShareViolation
public void OnShareViolation(
IFileDialog pfd,
IShellItem psi,
out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse)
{
// Do nothing: we will ignore share violations,
// and don't register
// for them, so this method should never be called.
pResponse = ShellNativeMethods.FileDialogEventShareViolationResponse.Accept;
}
示例11: OnFolderChanging
public HResult OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
{
CommonFileDialogFolderChangeEventArgs args = new CommonFileDialogFolderChangeEventArgs(
CommonFileDialog.GetFileNameFromShellItem(psiFolder));
if (!firstFolderChanged) { parent.OnFolderChanging(args); }
return (args.Cancel ? HResult.False : HResult.Ok);
}
示例12: OnFileOk
public HResult OnFileOk(IFileDialog pfd)
{
CancelEventArgs args = new CancelEventArgs();
parent.OnFileOk(args);
if (!args.Cancel)
{
// Make sure all custom properties are sync'ed
if (parent.Controls != null)
{
foreach (CommonFileDialogControl control in parent.Controls)
{
CommonFileDialogTextBox textBox;
CommonFileDialogGroupBox groupBox; ;
if ((textBox = control as CommonFileDialogTextBox) != null)
{
textBox.SyncValue();
textBox.Closed = true;
}
// Also check subcontrols
else if ((groupBox = control as CommonFileDialogGroupBox) != null)
{
foreach (CommonFileDialogControl subcontrol in groupBox.Items)
{
CommonFileDialogTextBox textbox = subcontrol as CommonFileDialogTextBox;
if (textbox != null)
{
textbox.SyncValue();
textbox.Closed = true;
}
}
}
}
}
}
return (args.Cancel ? HResult.False : HResult.Ok);
}
示例13: GetCustomizedFileDialog
/// <summary>
/// Get the IFileDialogCustomize interface, preparing to add controls.
/// </summary>
private void GetCustomizedFileDialog()
{
if (customize == null)
{
if (nativeDialog == null)
{
InitializeNativeFileDialog();
nativeDialog = GetNativeFileDialog();
}
customize = (IFileDialogCustomize)nativeDialog;
}
}
示例14: GetResult
private void GetResult(IFileDialog dialog)
{
IShellItem item;
dialog.GetResult(out item);
item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out _selectedPath);
}
示例15: IsOptionSet
private bool IsOptionSet(IFileDialog dialog, NativeMethods.FOS flag)
{
NativeMethods.FOS currentFlags = GetCurrentOptionFlags(dialog);
return (currentFlags & flag) == flag;
}