/// <summary> /// Gets file name for file "Save" operation</summary> /// <param name="service">File dialog service</param> /// <param name="pathName">Suggested file name and resulting file name</param> /// <param name="filter">File extension filter, e.g., "Setting file (*.xml;*.txt)|*.xml;*.txt|Any (*.*)|*.*"</param> /// <param name="directory">Directory that the user first sees, or null for default behavior</param> /// <returns>True iff operation is not cancelled</returns> public static FileDialogResult SaveFileName(this IFileDialogService service, ref string pathName, string filter, string directory) { string originalDir = service.ForcedInitialDirectory; try { service.ForcedInitialDirectory = directory; return(service.SaveFileName(ref pathName, filter)); } finally { service.ForcedInitialDirectory = originalDir; } }