Ejemplo n.º 1
0
        /// <summary>
        /// Dispose pattern.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_operationEnablementTask != null)
                {
                    _operationEnablementTask.Dispose();
                    _operationEnablementTask = null;
                }

                foreach (var folder in _workflowFolders)
                {
                    folder.Dispose();
                }

                if (_itemTools != null)
                {
                    _itemTools.Dispose();
                    _itemTools = null;
                }
                if (_folderTools != null)
                {
                    _folderTools.Dispose();
                    _folderTools = null;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Disposes of this object, its toos, dialogs, shelves and workspaces.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (_desktopTools != null)
                {
                    _desktopTools.Dispose();
                }

                if (_dialogs != null)
                {
                    (_dialogs as IDisposable).Dispose();
                }

                if (_workspaces != null)
                {
                    (_workspaces as IDisposable).Dispose();
                }

                if (_shelves != null)
                {
                    (_shelves as IDisposable).Dispose();
                }

                // These types of objects (particularly tools) can subscribe to each other's events
                // so we set everything to null at the end to allow objects to unsubscribe on disposal.
                _desktopTools = null;
                _dialogs      = null;
                _workspaces   = null;
                _shelves      = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called by the host when the application component is being terminated.
        /// </summary>
        public override void Stop()
        {
            _items.BindingList.ListChanged -= OnBindingListChanged;

            if (_disposeItemsOnClose)
            {
                foreach (IClipboardItem item in _items)
                {
                    if (item is IDisposable)
                    {
                        ((IDisposable)item).Dispose();
                    }
                }
            }

            _toolSet.Dispose();
            _toolSet = null;

            base.Stop();
        }