/// <summary> /// Custom method for forcing the description /// (This is a hack of Ookii's good work) /// </summary> public void SetDescription(string description) { if (_dialog == null) { return; } _useDescriptionForTitle = false; _description = description; Ookii.Dialogs.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Interop.IFileDialogCustomize)_dialog; customize.SetControlLabel(0, _description); }
private void SetDialogProperties(Ookii.Dialogs.Interop.IFileDialog dialog) { // [seanba] - Cache the dialog reference. We need it to update the title/description _dialog = dialog; // [seanba] - Need broswer dialog events uint cookie; dialog.Advise(new VistaFolderBrowserDialogEvents(this), out cookie); // [seanba] - Always have the additional text box present Ookii.Dialogs.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Interop.IFileDialogCustomize)dialog; customize.AddText(0, ""); // Description if (!string.IsNullOrEmpty(_description)) { if (_useDescriptionForTitle) { dialog.SetTitle(_description); } else { // [seanba] - Disable this. We'll always have the added text //Ookii.Dialogs.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Interop.IFileDialogCustomize)dialog; //customize.AddText(0, _description); customize.SetControlLabel(0, _description); } } dialog.SetOptions(NativeMethods.FOS.FOS_PICKFOLDERS | NativeMethods.FOS.FOS_FORCEFILESYSTEM | NativeMethods.FOS.FOS_FILEMUSTEXIST); if (!string.IsNullOrEmpty(_selectedPath)) { string parent = Path.GetDirectoryName(_selectedPath); if (parent == null || !Directory.Exists(parent)) { dialog.SetFileName(_selectedPath); } else { string folder = Path.GetFileName(_selectedPath); dialog.SetFolder(NativeMethods.CreateItemFromParsingName(parent)); dialog.SetFileName(folder); } } }