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);
                }
            }
        }
        internal virtual void SetDialogProperties(Ookii.Dialogs.Interop.IFileDialog dialog)
        {
            uint cookie;

            dialog.Advise(new VistaFileDialogEvents(this), out cookie);

            // Set the default file name
            if (!(_fileNames == null || _fileNames.Length == 0 || string.IsNullOrEmpty(_fileNames[0])))
            {
                string parent = Path.GetDirectoryName(_fileNames[0]);
                if (parent == null || !Directory.Exists(parent))
                {
                    dialog.SetFileName(_fileNames[0]);
                }
                else
                {
                    string folder = Path.GetFileName(_fileNames[0]);
                    dialog.SetFolder(Natives.CreateItemFromParsingName(parent));
                    dialog.SetFileName(folder);
                }
            }

            // Set the filter
            if (!string.IsNullOrEmpty(_filter))
            {
                string[] filterElements            = _filter.Split(new char[] { '|' });
                Natives.COMDLG_FILTERSPEC[] filter = new Natives.COMDLG_FILTERSPEC[filterElements.Length / 2];
                for (int x = 0; x < filterElements.Length; x += 2)
                {
                    filter[x / 2].pszName = filterElements[x];
                    filter[x / 2].pszSpec = filterElements[x + 1];
                }
                dialog.SetFileTypes((uint)filter.Length, filter);

                if (_filterIndex > 0 && _filterIndex <= filter.Length)
                {
                    dialog.SetFileTypeIndex((uint)_filterIndex);
                }
            }

            // Default extension
            if (_addExtension && !string.IsNullOrEmpty(_defaultExt))
            {
                dialog.SetDefaultExtension(_defaultExt);
            }

            // Initial directory
            if (!string.IsNullOrEmpty(_initialDirectory))
            {
                Interop.IShellItem item = Natives.CreateItemFromParsingName(_initialDirectory);
                dialog.SetDefaultFolder(item);
            }

            // ShowHelp
            if (_showHelp)
            {
                Ookii.Dialogs.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Interop.IFileDialogCustomize)dialog;
                customize.AddPushButton(HelpButtonId, "Help");
            }

            if (!string.IsNullOrEmpty(_title))
            {
                dialog.SetTitle(_title);
            }

            dialog.SetOptions((_options | Natives.FOS.FOS_FORCEFILESYSTEM));
        }