internal override string[] ProcessVistaFiles(FileDialogNative.IFileDialog dialog) { FileDialogNative.IFileSaveDialog saveDialog = (FileDialogNative.IFileSaveDialog)dialog; FileDialogNative.IShellItem item; dialog.GetResult(out item); return(new string[] { GetFilePathFromShellItem(item) }); }
internal System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.IWin32Window owner, FileDialogNative.IFileDialog f) { if (!string.IsNullOrEmpty(this.InitialDirectory)) { FileDialogNative.IShellItem item = null; try { SHCreateItemFromParsingName(this.InitialDirectory, IntPtr.Zero, typeof(FileDialogNative.IShellItem).GUID, out item); f.SetFolder(item); } catch (Exception e) { Util.Logging.Log(e); } if (item != null) { Marshal.ReleaseComObject(item); } } if (!string.IsNullOrEmpty(this.FileName)) { f.SetFileName(this.FileName); } if (!string.IsNullOrEmpty(this.Filter)) { var filter = this.Filter.Split('|'); var filters = new FileDialogNative.COMDLG_FILTERSPEC[filter.Length / 2]; for (var i = 0; i < filter.Length; i += 2) { filters[i / 2] = new FileDialogNative.COMDLG_FILTERSPEC() { pszName = filter[i], pszSpec = filter[i + 1], }; } f.SetFileTypes((uint)filters.Length, filters); f.SetFileTypeIndex((uint)this.FilterIndex); } if (!string.IsNullOrEmpty(this.Title)) { f.SetTitle(this.Title); } if (f.Show(owner.Handle) == 0) { FileDialogNative.IShellItem item; f.GetResult(out item); string ppszName; item.GetDisplayName(FileDialogNative.SIGDN.SIGDN_FILESYSPATH, out ppszName); Marshal.ReleaseComObject(item); this.FileName = ppszName; return(System.Windows.Forms.DialogResult.OK); } return(System.Windows.Forms.DialogResult.Cancel); }