Example #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));
        }
Example #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);
        }
Example #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);
 }
Example #4
0
File: Shelf.cs Project: nhannd/Xian
 /// <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);
 }
Example #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="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));
        }
Example #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="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));
        }
Example #7
0
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            [param: Localizable(true)] string title,
            ShelfDisplayHint displayHint,
            ApplicationComponentExitDelegate exitCallback)
        {
            var args = new ShelfCreationArgs(component, title, null, displayHint);

            return(LaunchAsShelf(desktopWindow, args, exitCallback));
        }
Example #8
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);
        }
Example #9
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));
        }
Example #10
0
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            [param: Localizable(true)] string title,
            string name,
            ShelfDisplayHint displayHint,
            ApplicationComponentExitDelegate exitCallback)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(component, "component");

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

            return(LaunchAsShelf(desktopWindow, args, exitCallback));
        }
Example #11
0
 public Shelf CreateShelf(ShelfCreationArgs args, DesktopWindow window)
 {
     return(new Shelf(args, window));
 }