public DialogResult ShowDialog(IWin32Window owner, IFileDialogUICallbacks uiCallbacks) { if (uiCallbacks == null) { throw new ArgumentNullException("uiCallbacks"); } this.uiCallbacks = uiCallbacks; int hrCCD = FileDialog.ClearClientData(); uint dwCookie = 0xdeadbeef; if (this.fileDialogEvents != null) { FileDialog.Advise(this.fileDialogEvents, out dwCookie); } OnBeforeShow(); int hr = 0; UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { hr = this.fileDialog.Show(modalOwner.Handle); GC.KeepAlive(modalOwner); }); DialogResult result; if (hr >= 0) { result = DialogResult.OK; } else { result = DialogResult.Cancel; } this.dialogResult = result; if (this.fileDialogEvents != null) { FileDialog.Unadvise(dwCookie); } OnAfterShow(); this.uiCallbacks = null; GC.KeepAlive(owner); return(result); }
public DialogResult ShowDialog(IWin32Window owner, IFileDialogUICallbacks uiCallbacks) { Control ownerAsControl = owner as Control; if (uiCallbacks == null) { throw new ArgumentNullException("uiCallbacks"); } Cursor.Current = Cursors.WaitCursor; if ((Control.ModifierKeys & Keys.Shift) != 0) { UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { while ((Control.ModifierKeys & Keys.Shift) != 0) { System.Threading.Thread.Sleep(1); Application.DoEvents(); } }); } Cursor.Current = Cursors.Default; DialogResult result = DialogResult.Cancel; UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { if (ownerAsControl != null && ownerAsControl.IsHandleCreated) { ownerAsControl.BeginInvoke(new Procedure <FileDialog>(EnableThumbnailView), new object[] { this.FileDialog }); } result = this.FileDialog.ShowDialog(modalOwner); }); return(result); }
public DialogResult ShowDialog(IWin32Window owner, IFileDialogUICallbacks uiCallbacks) { Control ownerAsControl = owner as Control; if (uiCallbacks == null) { throw new ArgumentNullException("uiCallbacks"); } Cursor.Current = Cursors.WaitCursor; if ((Control.ModifierKeys & Keys.Shift) != 0) { UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { while ((Control.ModifierKeys & Keys.Shift) != 0) { System.Threading.Thread.Sleep(1); Application.DoEvents(); } }); } Cursor.Current = Cursors.Default; DialogResult result = DialogResult.Cancel; UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { if (ownerAsControl != null && ownerAsControl.IsHandleCreated) { ownerAsControl.BeginInvoke(new Procedure<FileDialog>(EnableThumbnailView), new object[] { this.fileDialog }); } result = this.fileDialog.ShowDialog(modalOwner); }); return result; }
public DialogResult ShowDialog(IWin32Window owner, IFileDialogUICallbacks uiCallbacks) { if (uiCallbacks == null) { throw new ArgumentNullException("uiCallbacks"); } this.uiCallbacks = uiCallbacks; int hrCCD = FileDialog.ClearClientData(); uint dwCookie = 0xdeadbeef; if (this.fileDialogEvents != null) { FileDialog.Advise(this.fileDialogEvents, out dwCookie); } OnBeforeShow(); int hr = 0; UI.InvokeThroughModalTrampoline( owner, delegate(IWin32Window modalOwner) { hr = this.fileDialog.Show(modalOwner.Handle); GC.KeepAlive(modalOwner); }); DialogResult result; if (hr >= 0) { result = DialogResult.OK; } else { result = DialogResult.Cancel; } this.dialogResult = result; if (this.fileDialogEvents != null) { FileDialog.Unadvise(dwCookie); } OnAfterShow(); this.uiCallbacks = null; GC.KeepAlive(owner); return result; }