Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
コード例 #1
0
 public void Dispose()
 {
     if (_CustomControl != null)
     {
         if (!_CustomControl.IsDisposed)
         {
             if (_CustomControl.MSDialog != null)
             {
                 _CustomControl.MSDialog.Disposed -= new EventHandler(DialogWrappper_Disposed);
                 _CustomControl.MSDialog.Dispose();
             }
             //might have been nulled by MSDialog.Dispose()
             if (_CustomControl != null)
             {
                 _CustomControl.MSDialog = null;
                 _CustomControl.Dispose();
             }
             _CustomControl = null;
         }
     }
     if (_BaseDialogNative != null)
     {
         _BaseDialogNative.Dispose();
         _BaseDialogNative = null;
     }
     if (_hDummyWnd != IntPtr.Zero)
     {
         NativeMethods.DestroyWindow(_hDummyWnd);
         DestroyHandle();
         _hDummyWnd = IntPtr.Zero;
     }
 }
コード例 #2
0
            public void Dispose()
            {
                //ReleaseHandle();
                if (_CustomCtrl != null && _CustomCtrl.MSDialog != null)
                {
                    _CustomCtrl.MSDialog.Disposed -= new EventHandler(NativeDialogWrapper_Disposed);
                    _CustomCtrl.MSDialog.Dispose();
                    if (_CustomCtrl != null)
                    {
                        _CustomCtrl.MSDialog = null;
                    }
                }
                if (_CustomCtrl != null)
                {
                    _CustomCtrl.Dispose();
                    _CustomCtrl = null;
                }

                DestroyHandle();
            }
コード例 #3
0
 public void Dispose()
 {
     //ReleaseHandle();
     if (_CustomControl != null && _CustomControl.MSDialog != null)
     {
         _CustomControl.MSDialog.Disposed -= new EventHandler(DialogWrappper_Disposed);
         _CustomControl.MSDialog.Dispose();
         _CustomControl.MSDialog = null;
     }
     if (_CustomControl != null)
     {
         _CustomControl.Disposed -= new EventHandler(DialogWrappper_Disposed);
         _CustomControl.Dispose();
         _CustomControl = null;
     }
     if (_BaseDialogNative != null)
     {
         _BaseDialogNative.Dispose();
         _BaseDialogNative = null;
     }
     NativeMethods.DestroyWindow(_hDummyWnd);
     DestroyHandle();
 }