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); } }
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); }