コード例 #1
0
        private bool HandleVistaFileOk(IFileDialog dialog)
        {
            UnsafeNativeMethods.IOleWindow oleWindow = (UnsafeNativeMethods.IOleWindow)dialog;
            oleWindow.GetWindow(out this._hwndFileDialog);
            int value       = this._dialogOptions.Value;
            int filterIndex = this._filterIndex;

            string[] fileNames = this._fileNames;
            bool     flag      = false;

            try
            {
                uint fileTypeIndex = dialog.GetFileTypeIndex();
                this._filterIndex = (int)fileTypeIndex;
                this._fileNames   = this.ProcessVistaFiles(dialog);
                if (this.ProcessFileNames())
                {
                    CancelEventArgs cancelEventArgs = new CancelEventArgs();
                    this.OnFileOk(cancelEventArgs);
                    flag = !cancelEventArgs.Cancel;
                }
            }
            finally
            {
                if (!flag)
                {
                    this._fileNames           = fileNames;
                    this._dialogOptions.Value = value;
                    this._filterIndex         = filterIndex;
                }
                else if ((this.Options & 4) != 0)
                {
                    this._dialogOptions.Value = (this._dialogOptions.Value & -2);
                }
            }
            return(flag);
        }
コード例 #2
0
 int UnsafeNativeMethods.IOleWindow.GetWindow(out IntPtr hwnd)
 {
     IntSecurity.UnmanagedCode.Assert();
     return(publicIOleWindow.GetWindow(out hwnd));
 }