private void InitializeEventSink(IFileDialog nativeDlg) { // Check if we even need to have a sink. if (FileOk != null || FolderChanging != null || FolderChanged != null || SelectionChanged != null || FileTypeChanged != null || DialogOpening != null || (controls != null && controls.Count > 0)) { uint cookie; nativeEventSink = new NativeDialogEventSink(this); nativeDlg.Advise(nativeEventSink, out cookie); nativeEventSink.Cookie = cookie; } }
private void InitializeEventSink(IFileDialog nativeDialog) { // Check if we even need to have a sink if (FileOk != null || FolderChanging != null || FolderChanged != null || SelectionChanged != null || FileTypeChanged != null || Opening != null || (controls != null && controls.Count > 0)) { uint cookie; nativeEventSink = new NativeDialogEventSink(this); nativeDialog.Advise(nativeEventSink, out cookie); nativeEventSink.Cookie = cookie; } }
private void CleanupEventSink() { if (nativeEventSink != null) { nativeDialog.Unadvise(nativeEventSink.Cookie); nativeEventSink = null; } }