private bool RunDialog(IntPtr owner)
 {
     Ookii.Dialogs.Wpf.Interop.IFileDialog dialog = null;
     try
     {
         dialog = new Ookii.Dialogs.Wpf.Interop.NativeFileOpenDialog();
         SetDialogProperties(dialog);
         int result = dialog.Show(owner);
         if (result < 0)
         {
             if ((uint)result == (uint)HRESULT.ERROR_CANCELLED)
             {
                 return(false);
             }
             else
             {
                 throw System.Runtime.InteropServices.Marshal.GetExceptionForHR(result);
             }
         }
         GetResult(dialog);
         return(true);
     }
     finally
     {
         if (dialog != null)
         {
             System.Runtime.InteropServices.Marshal.FinalReleaseComObject(dialog);
         }
     }
 }
 /// <summary>
 ///  When overridden in a derived class, displays a particular type of common dialog box.
 /// </summary>
 protected override bool RunDialog(IntPtr owner)
 {
     if (!IsVistaFolderDialogSupported)
     {
         return(RunDialogDownlevel(owner));
     }
     Ookii.Dialogs.Wpf.Interop.IFileDialog dialog = null;
     try
     {
         dialog = new Ookii.Dialogs.Wpf.Interop.NativeFileOpenDialog();
         SetDialogProperties(dialog);
         int result = dialog.Show(owner);
         if (result < 0)
         {
             if (result == (int)HRESULT.ERROR_CANCELLED)
             {
                 return(false);
             }
             else
             {
                 throw System.Runtime.InteropServices.Marshal.GetExceptionForHR(result);
             }
         }
         GetResult(dialog);
         return(true);
     }
     finally
     {
         if (dialog != null)
         {
             System.Runtime.InteropServices.Marshal.FinalReleaseComObject(dialog);
         }
     }
 }
        private bool RunDialog(IntPtr owner)
        {
            Ookii.Dialogs.Wpf.Interop.IFileDialog dialog = null;
            try
            {
                dialog = new Ookii.Dialogs.Wpf.Interop.NativeFileOpenDialog();
                SetDialogProperties(dialog);

                int result = dialog.Show(owner);
                if( result < 0 )
                {
                    if( (uint)result == (uint)HRESULT.ERROR_CANCELLED )
                        return false;
                    else
                        throw System.Runtime.InteropServices.Marshal.GetExceptionForHR(result);
                }
                GetResult(dialog);
                return true;
            }
            finally
            {
                if( dialog != null )
                    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(dialog);
            }
        }