private void SetDialogProperties(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
        {
            // Description
            if (!string.IsNullOrEmpty(_description))
            {
                if (UseDescriptionForTitle)
                {
                    dialog.SetTitle(_description);
                }
                else
                {
                    Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize)dialog;
                    customize.AddText(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 override void GetResult(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
        {
            if (Multiselect)
            {
                Ookii.Dialogs.Wpf.Interop.IShellItemArray results;
                ((Ookii.Dialogs.Wpf.Interop.IFileOpenDialog)dialog).GetResults(out results);
                uint count;
                results.GetCount(out count);
                string[] fileNames = new string[count];
                for (uint x = 0; x < count; ++x)
                {
                    Ookii.Dialogs.Wpf.Interop.IShellItem item;
                    results.GetItemAt(x, out item);
                    string name;
                    item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out name);
                    fileNames[x] = name;
                }
                FileNamesInternal = fileNames;
            }
            else
            {
                FileNamesInternal = null;
            }

            if (ShowReadOnly)
            {
                Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize)dialog;
                int selected;
                customize.GetSelectedControlItem(_openDropDownId, out selected);
                _readOnlyChecked = (selected == _readOnlyItemId);
            }

            base.GetResult(dialog);
        }
 internal override void SetDialogProperties(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
 {
     base.SetDialogProperties(dialog);
     if (_showReadOnly)
     {
         Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize)dialog;
         customize.EnableOpenDropDown(_openDropDownId);
         customize.AddControlItem(_openDropDownId, _openItemId, ComDlgResources.LoadString(ComDlgResources.ComDlgResourceId.OpenButton));
         customize.AddControlItem(_openDropDownId, _readOnlyItemId, ComDlgResources.LoadString(ComDlgResources.ComDlgResourceId.ReadOnly));
     }
 }
Пример #4
0
        internal override void GetResult(IFileDialog dialog)
        {
            Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize)dialog;
            int selected;

            customize.GetSelectedControlItem(_comboBoxId, out selected);

            SetRelativePathsProcessing(selected);

            base.GetResult(dialog);
        }
Пример #5
0
        internal override void SetDialogProperties(IFileDialog dialog)
        {
            base.SetDialogProperties(dialog);

            uint cookie;
            var  events = new TraceLabSaveAsDialogEvents(this);

            dialog.Advise(events, out cookie);

            Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize customize = (Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize)dialog;

            customize.StartVisualGroup(_configVisualGroupId, "Referenced files:");
            customize.AddComboBox(_comboBoxId);
            customize.AddControlItem(_comboBoxId, _ignoreId, ignoreLabel);
            customize.AddControlItem(_comboBoxId, _copyId, copyLabel);
            customize.AddControlItem(_comboBoxId, _copyOverwriteId, copyOverwriteLabel);
            customize.AddControlItem(_comboBoxId, _keepReferenceId, determinePathsLabel);
            customize.SetSelectedControlItem(_comboBoxId, _ignoreId); //select default
            customize.EndVisualGroup();

            customize.AddText(_helpTextId, ignoreDescription);
        }