Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new shelf.
        /// </summary>
        private Shelf CreateShelf(ShelfCreationArgs args)
        {
            IShelfFactory factory = CollectionUtils.FirstElement <IShelfFactory>(
                (new ShelfFactoryExtensionPoint()).CreateExtensions()) ?? new DefaultShelfFactory();

            return(factory.CreateShelf(args, _owner));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens a new shelf given the input <see cref="ShelfCreationArgs"/>.
        /// </summary>
        public Shelf AddNew(ShelfCreationArgs args)
        {
            Shelf shelf = CreateShelf(args);

            Open(shelf);
            return(shelf);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="args">Object used to specify how the <see cref="Shelf"/> should be created.</param>
 /// <param name="desktopWindow">The owner window of the <see cref="Shelf"/>.</param>
 protected internal Shelf(ShelfCreationArgs args, DesktopWindow desktopWindow)
     : base(args)
 {
     _desktopWindow = desktopWindow;
     _displayHint   = args.DisplayHint;
     _host          = new Host(this, args.Component);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Executes the specified application component in a new shelf.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
        /// will be propagate to the caller of this method and the component will not be launched.
        /// </remarks>
        /// <param name="desktopWindow">The desktop window in which the shelf will run.</param>
        /// <param name="creationArgs">A <see cref="ShelfCreationArgs"/> object.</param>
        /// <returns>The shelf that is hosting the component.</returns>
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            ShelfCreationArgs creationArgs)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(creationArgs, "creationArgs");

            return(LaunchAsShelf(desktopWindow, creationArgs, null));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Executes the specified application component in a new shelf.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
        /// will be propagate to the caller of this method and the component will not be launched.
        /// </remarks>
        /// <param name="desktopWindow">The desktop window in which the shelf will run.</param>
        /// <param name="component">The application component to launch.</param>
        /// <param name="title">The title of the shelf.</param>
        /// <param name="displayHint">A hint as to how the shelf should initially be displayed.</param>
        /// <returns>The shelf that is hosting the component.</returns>
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title,
            ShelfDisplayHint displayHint)
        {
            var args = new ShelfCreationArgs(component, title, null, displayHint);

            return(LaunchAsShelf(desktopWindow, args, null));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Executes the specified application component in a new shelf.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
        /// will be propagate to the caller of this method and the component will not be launched.
        /// </remarks>
        /// <param name="desktopWindow">The desktop window in which the shelf will run.</param>
        /// <param name="component">The application component to launch.</param>
        /// <param name="title">The title of the shelf.</param>
        /// <param name="name">The unique name of the shelf.</param>
        /// <param name="displayHint">A hint as to how the shelf should initially be displayed.</param>
        /// <returns>The shelf that is hosting the component.</returns>
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title,
            string name,
            ShelfDisplayHint displayHint)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(component, "component");

            var args = new ShelfCreationArgs(component, title, name, displayHint);

            return(LaunchAsShelf(desktopWindow, args, null));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Private helper method to support LaunchAsShelf
        /// </summary>
        private static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            ShelfCreationArgs args,
            ApplicationComponentExitDelegate exitCallback)
        {
            var shelf = desktopWindow.Shelves.AddNew(args);

            if (exitCallback != null)
            {
                shelf.Closed += delegate
                {
                    exitCallback(args.Component);
                };
            }
            return(shelf);
        }
Ejemplo n.º 8
0
 public Shelf CreateShelf(ShelfCreationArgs args, DesktopWindow window)
 {
     return(new Shelf(args, window));
 }