本文整理汇总了C#中IFileDialog.AddPlace方法的典型用法代码示例。如果您正苦于以下问题:C# IFileDialog.AddPlace方法的具体用法?C# IFileDialog.AddPlace怎么用?C# IFileDialog.AddPlace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileDialog
的用法示例。
在下文中一共展示了IFileDialog.AddPlace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareVistaDialog
internal virtual void PrepareVistaDialog(IFileDialog dialog)
{
dialog.SetDefaultExtension(DefaultExt);
dialog.SetFileName(CriticalFileName);
if (!string.IsNullOrEmpty(InitialDirectory))
{
IShellItem initialDirectory = ShellUtil.GetShellItemForPath(InitialDirectory);
if (initialDirectory != null)
{
// Setting both of these so the dialog doesn't display errors when a remembered folder is missing.
dialog.SetDefaultFolder(initialDirectory);
dialog.SetFolder(initialDirectory);
}
}
dialog.SetTitle(Title);
// Force no mini mode for the SaveFileDialog.
// Only accept physically backed locations.
FOS options = ((FOS)Options & c_VistaFileDialogMask) | FOS.DEFAULTNOMINIMODE | FOS.FORCEFILESYSTEM;
dialog.SetOptions(options);
COMDLG_FILTERSPEC[] filterItems = GetFilterItems(Filter);
if (filterItems.Length > 0)
{
dialog.SetFileTypes((uint)filterItems.Length, filterItems);
dialog.SetFileTypeIndex(unchecked((uint)FilterIndex));
}
IList<FileDialogCustomPlace> places = CustomPlaces;
if (places != null && places.Count != 0)
{
foreach (FileDialogCustomPlace customPlace in places)
{
IShellItem shellItem = ResolveCustomPlace(customPlace);
if (shellItem != null)
{
try
{
dialog.AddPlace(shellItem, FDAP.BOTTOM);
}
catch (ArgumentException)
{
// The dialog doesn't allow some ShellItems to be set as Places (like device ports).
// Silently ---- errors here.
}
}
}
}
}