Example #1
0
 private bool RunDialogVista(IntPtr hWndOwner)
 {
     FileDialogNative.IFileDialog dialog = CreateVistaDialog();
     OnBeforeVistaDialog(dialog);
     VistaDialogEvents events = new VistaDialogEvents(this);
     uint eventCookie;
     dialog.Advise(events, out eventCookie);
     try
     {
         int result = dialog.Show(hWndOwner);
         return 0 == result;
     }
     finally
     {
         dialog.Unadvise(eventCookie);
         //Make sure that the event interface doesn't get collected
         GC.KeepAlive(events);
     }
 }
Example #2
0
        private bool RunDialogVista(IntPtr hWndOwner)
        {
            FileDialogNative.IFileDialog dialog = CreateVistaDialog();
            OnBeforeVistaDialog(dialog);
            VistaDialogEvents events = new VistaDialogEvents(this);
            uint eventCookie;

            dialog.Advise(events, out eventCookie);
            try
            {
                int result = dialog.Show(hWndOwner);
                return(0 == result);
            }
            finally
            {
                dialog.Unadvise(eventCookie);
                //Make sure that the event interface doesn't get collected
                GC.KeepAlive(events);
            }
        }
Example #3
0
        private bool RunDialogVista(IntPtr hWndOwner)
        {
            uint num;
            bool flag;

            FileDialogNative.IFileDialog dialog = this.CreateVistaDialog();
            this.OnBeforeVistaDialog(dialog);
            VistaDialogEvents pfde = new VistaDialogEvents(this);

            dialog.Advise(pfde, out num);
            try
            {
                int num2 = dialog.Show(hWndOwner);
                flag = 0 == num2;
            }
            finally
            {
                dialog.Unadvise(num);
                GC.KeepAlive(pfde);
            }
            return(flag);
        }
        private bool RunVistaDialog(IntPtr hwndOwner)
        {
            IFileDialog dialog = CreateVistaDialog();
            
            PrepareVistaDialog(dialog);

            using (VistaDialogEvents events = new VistaDialogEvents(dialog, HandleVistaFileOk))
            {
                return dialog.Show(hwndOwner).Succeeded;
            }
        }
 private bool RunDialogVista(IntPtr hWndOwner)
 {
     uint num;
     bool flag;
     FileDialogNative.IFileDialog dialog = this.CreateVistaDialog();
     this.OnBeforeVistaDialog(dialog);
     VistaDialogEvents pfde = new VistaDialogEvents(this);
     dialog.Advise(pfde, out num);
     try
     {
         int num2 = dialog.Show(hWndOwner);
         flag = 0 == num2;
     }
     finally
     {
         dialog.Unadvise(num);
         GC.KeepAlive(pfde);
     }
     return flag;
 }