Beispiel #1
0
        public void Dispose()
        {
            if (isDisposed)
            {
                return;
            }
            SafeExecutor    executor = new SafeExecutor(this);
            CancelEventArgs args     = new CancelEventArgs();

            executor.Execute(delegate()
            {
                OnDisposing(args);
            });
            if (!args.Cancel)
            {
                isDisposed = true;
                object currentControl = control;
                executor.Execute(delegate()
                {
                    DisposeCore();
                });
                executor.Execute(delegate()
                {
                    BreakLinksToControls();
                });
                errorMessages               = null;
                ControlsCreated             = null;
                Closing                     = null;
                Closed                      = null;
                QueryCanClose               = null;
                CaptionChanged              = null;
                ModelChanging               = null;
                ModelChanged                = null;
                ModelSaving                 = null;
                ModelSaved                  = null;
                CustomModelSaving           = null;
                Disposing                   = null;
                AllowDeleteChanged          = null;
                AllowEditChanged            = null;
                AllowNewChanged             = null;
                CustomizeViewShortcut       = null;
                CurrentObjectChanged        = null;
                SelectionChanged            = null;
                SelectionTypeChanged        = null;
                QueryCanChangeCurrentObject = null;
                if (currentControl != null && currentControl is IDisposable)
                {
                    executor.Dispose((IDisposable)currentControl);
                    currentControl = null;
                }
            }
            executor.ThrowExceptionIfAny();
        }
 /// <summary>
 ///   Creates an instance of <see cref = "PropertyChangedBase" />.
 /// </summary>
 public PropertyChangedBase()
 {
     executor    = new SafeExecutor(this);
     IsNotifying = true;
 }
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Illusion.BindableCollection{T}" /> class.
 /// </summary>
 public BindableCollection()
 {
     IsNotifying = true;
     executor    = new SafeExecutor(this);
 }