public Interop.HRESULT OnFileOk(Ookii.Dialogs.Interop.IFileDialog pfd)
 {
     if( _dialog.DoFileOk(pfd) )
         return Ookii.Dialogs.Interop.HRESULT.S_OK;
     else
         return Ookii.Dialogs.Interop.HRESULT.S_FALSE;
 }
Esempio n. 2
0
 internal virtual void GetResult(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
 {
     if( !GetOption(NativeMethods.FOS.FOS_ALLOWMULTISELECT) )
     {
         _fileNames = new string[1];
         Ookii.Dialogs.Wpf.Interop.IShellItem result;
         dialog.GetResult(out result);
         result.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out _fileNames[0]);
     }
 }
        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));
     }
 }
 public void OnControlActivating(Ookii.Dialogs.Interop.IFileDialogCustomize pfdc, int dwIDCtl)
 {
 }
 public void OnCheckButtonToggled(Ookii.Dialogs.Interop.IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked)
 {
 }
 public void OnButtonClicked(Ookii.Dialogs.Wpf.Interop.IFileDialogCustomize pfdc, int dwIDCtl)
 {
 }
 private void GetResult(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
 {
     Ookii.Dialogs.Wpf.Interop.IShellItem item;
     dialog.GetResult(out item);
     item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out _selectedPath);
 }
 public void OnOverwrite(Ookii.Dialogs.Interop.IFileDialog pfd, Ookii.Dialogs.Interop.IShellItem psi, out NativeMethods.FDE_OVERWRITE_RESPONSE pResponse)
 {
     pResponse = NativeMethods.FDE_OVERWRITE_RESPONSE.FDEOR_DEFAULT;
 }
 public void OnTypeChange(Ookii.Dialogs.Interop.IFileDialog pfd)
 {
 }
 public void OnShareViolation(Ookii.Dialogs.Interop.IFileDialog pfd, Ookii.Dialogs.Interop.IShellItem psi, out NativeMethods.FDE_SHAREVIOLATION_RESPONSE pResponse)
 {
     pResponse = NativeMethods.FDE_SHAREVIOLATION_RESPONSE.FDESVR_DEFAULT;
 }
 public void OnSelectionChange(Ookii.Dialogs.Interop.IFileDialog pfd)
 {
 }
 public void OnFolderChange(Ookii.Dialogs.Interop.IFileDialog pfd)
 {
 }
 public Interop.HRESULT OnFolderChanging(Ookii.Dialogs.Interop.IFileDialog pfd, Ookii.Dialogs.Interop.IShellItem psiFolder)
 {
     return Ookii.Dialogs.Interop.HRESULT.S_OK;
 }
Esempio n. 15
0
        internal virtual void SetDialogProperties(Ookii.Dialogs.Wpf.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(NativeMethods.CreateItemFromParsingName(parent));
                    dialog.SetFileName(folder);
                }
            }

            // Set the filter
            if( !string.IsNullOrEmpty(_filter) )
            {
                string[] filterElements = _filter.Split(new char[] { '|' });
                NativeMethods.COMDLG_FILTERSPEC[] filter = new NativeMethods.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) )
            {
                Ookii.Dialogs.Wpf.Interop.IShellItem item = NativeMethods.CreateItemFromParsingName(_initialDirectory);
                dialog.SetDefaultFolder(item);
            }

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

            dialog.SetOptions((_options | NativeMethods.FOS.FOS_FORCEFILESYSTEM));
        }
 public void OnItemSelected(Ookii.Dialogs.Interop.IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem)
 {
 }
Esempio n. 17
0
        internal bool DoFileOk(Ookii.Dialogs.Wpf.Interop.IFileDialog dialog)
        {
            GetResult(dialog);

            System.ComponentModel.CancelEventArgs e = new System.ComponentModel.CancelEventArgs();
            OnFileOk(e);
            return !e.Cancel;
        }
 public void OnButtonClicked(Ookii.Dialogs.Interop.IFileDialogCustomize pfdc, int dwIDCtl)
 {
     if( dwIDCtl == VistaFileDialog.HelpButtonId )
         _dialog.DoHelpRequest();
 }
        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.GetFullPath( _selectedPath);
                if( parent == null || !Directory.Exists(parent) )
                {
                    dialog.SetFileName(_selectedPath);
                }
                else
                {
                    string folder = Path.GetDirectoryName(_selectedPath);
                    dialog.SetFolder(NativeMethods.CreateItemFromParsingName(parent));
                    dialog.SetFileName(folder);
                }
            }
        }
        private void GetResult(Ookii.Dialogs.Interop.IFileDialog dialog)
        {
            if (Multiselect)
            {
                Ookii.Dialogs.Interop.IShellItemArray results;
                ((Ookii.Dialogs.Interop.IFileOpenDialog)dialog).GetResults(out results);
                uint count;
                results.GetCount(out count);
                string[] selectedPaths = new string[count];
                for (uint x = 0; x < count; ++x)
                {
                    Ookii.Dialogs.Interop.IShellItem item;
                    results.GetItemAt(x, out item);
                    string name;
                    item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out name);
                    selectedPaths[x] = name;
                }
                _selectedPaths = selectedPaths;

            }
            else
            {
                Ookii.Dialogs.Interop.IShellItem item;
                dialog.GetResult(out item);
                item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out _selectedPaths[0]);
            }
        }