예제 #1
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;
            }
        }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        protected internal DesktopWindow(DesktopWindowCreationArgs args, Application application)
            : base(args)
        {
            _application = application;
            _workspaces  = new WorkspaceCollection(this);
            _shelves     = new ShelfCollection(this);
            _dialogs     = new DialogBoxCollection(this);

            // if no title supplied, create a default title
            _baseTitle = !string.IsNullOrEmpty(args.Title) ? args.Title : DefaultBaseTitle;

            _menuActionSite    = args.MenuSite ?? GlobalMenus;
            _toolbarActionSite = args.ToolbarSite ?? GlobalToolbars;
        }