Beispiel #1
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);
 }
Beispiel #2
0
        public static Shelf LaunchAsShelf(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title,
            ShelfDisplayHint displayHint,
            ApplicationComponentExitDelegate exitCallback)
        {
            var args = new ShelfCreationArgs(component, title, null, displayHint);

            return(LaunchAsShelf(desktopWindow, args, exitCallback));
        }
Beispiel #3
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));
        }
        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));
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the <see cref="Shelf"/>.</param>
 /// <param name="title">The title of the <see cref="Shelf"/>.</param>
 /// <param name="name">A name/identifier for the <see cref="Shelf"/>.</param>
 /// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
 public ShelfCreationArgs(IApplicationComponent component, string title, string name, ShelfDisplayHint displayHint)
     : base(title, name)
 {
     _component   = component;
     _displayHint = displayHint;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
		/// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the <see cref="Shelf"/>.</param>
		/// <param name="title">The title of the <see cref="Shelf"/>.</param>
		/// <param name="name">A name/identifier for the <see cref="Shelf"/>.</param>
		/// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
		public ShelfCreationArgs(IApplicationComponent component, string title, string name, ShelfDisplayHint displayHint)
            : base(title, name)
        {
            _component = component;
            _displayHint = displayHint;
        }
Beispiel #7
0
        private static void LaunchShelf(IDesktopWindow desktopWindow, IApplicationComponent component, ShelfDisplayHint shelfDisplayHint)
        {
            IShelf shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleCine, "Cine", shelfDisplayHint);

            Shelves[desktopWindow]         = shelf;
            Shelves[desktopWindow].Closed += OnShelfClosed;
        }
Beispiel #8
0
 public static void Show(ShelfDisplayHint displayHint)
 {
     Show(null, displayHint);
 }
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the <see cref="Shelf"/>.</param>
		/// <param name="title">The title of the <see cref="Shelf"/>.</param>
		/// <param name="name">A name/identifier for the <see cref="Shelf"/>.</param>
		/// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
		public ShelfCreationArgs(IApplicationComponent component, [param : Localizable(true)] string title, string name, ShelfDisplayHint displayHint)
			: base(title, name)
		{
			_component = component;
			_displayHint = displayHint;
		}
Beispiel #10
0
 /// <summary>
 /// Opens a new shelf.
 /// </summary>
 /// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the returned <see cref="Shelf"/>.</param>
 /// <param name="title">The title of the <see cref="Shelf"/>.</param>
 /// <param name="name">A name/identifier for the <see cref="Shelf"/>.</param>
 /// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
 public Shelf AddNew(IApplicationComponent component, string title, string name, ShelfDisplayHint displayHint)
 {
     return(AddNew(new ShelfCreationArgs(component, title, name, displayHint)));
 }
Beispiel #11
0
 /// <summary>
 /// Opens a new shelf.
 /// </summary>
 /// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the returned <see cref="Shelf"/>.</param>
 /// <param name="title">The title of the <see cref="Shelf"/>.</param>
 /// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
 public Shelf AddNew(IApplicationComponent component, string title, ShelfDisplayHint displayHint)
 {
     return(AddNew(component, title, null, displayHint));
 }
Beispiel #12
0
        internal Content AddShelfView(ShelfView shelfView, Control control, string title, ShelfDisplayHint hint, MemoryStream shelfRestoreStream)
        {
        	// Forcing this makes the control resize *before* adding it to the DotNetMagic control, 
        	// so the shelf will be the correct size.  This would be done automatically when the
			// control gets added - we're just doing it a bit prematurely in order to get the correct size.
        	control.Font = _form.DockingManager.TabControlFont;
        	var displaySize = control.Size;

			var content = _form.DockingManager.Contents.Add(control, title);
			content.Tag = shelfView;

			if (shelfRestoreStream != null)
			{
				content.LoadContentFromStream(shelfRestoreStream);

				// #4183 - the shelf restore stream includes the shelf title, which is supposed to be determined by the model/localization and not persisted
				content.Title = content.FullTitle = title;

				_form.DockingManager.ShowContent(content);
				if (content.IsAutoHidden && hint != ShelfDisplayHint.HideOnWorkspaceOpen)
					_form.DockingManager.BringAutoHideIntoView(content);

				return content;
			}

        	content.DisplaySize = displaySize;
        	content.AutoHideSize = displaySize;
        	content.FloatingSize = displaySize;

        	if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
        		_form.DockingManager.Container.SuspendLayout();

        	// Dock the window on the correct edge
        	if ((hint & ShelfDisplayHint.DockTop) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockTop);
        	}
        	else if ((hint & ShelfDisplayHint.DockBottom) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockBottom);
        	}
        	else if ((hint & ShelfDisplayHint.DockLeft) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockLeft);
        	}
        	else if ((hint & ShelfDisplayHint.DockRight) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockRight);
        	}
        	else
        	{
				if ((hint & ShelfDisplayHint.ShowNearMouse) == ShelfDisplayHint.ShowNearMouse)
				{
					content.DisplayLocation = Control.MousePosition;
				}

        		_form.DockingManager.AddContentWithState(content, State.Floating);
        	}

		    if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.ToggleContentAutoHide(content);
                _form.DockingManager.Container.ResumeLayout();
                _form.DockingManager.BringAutoHideIntoView(content);
            }

            return content;
        }
Beispiel #13
0
        internal Content AddShelfView(ShelfView shelfView, Control control, string title, ShelfDisplayHint hint, MemoryStream shelfRestoreStream)
        {
            // Forcing this makes the control resize *before* adding it to the DotNetMagic control,
            // so the shelf will be the correct size.  This would be done automatically when the
            // control gets added - we're just doing it a bit prematurely in order to get the correct size.
            control.Font = _form.DockingManager.TabControlFont;
            var displaySize = control.Size;

            var content = _form.DockingManager.Contents.Add(control, title);

            content.Tag = shelfView;

            if (shelfRestoreStream != null)
            {
                content.LoadContentFromStream(shelfRestoreStream);

                // #4183 - the shelf restore stream includes the shelf title, which is supposed to be determined by the model/localization and not persisted
                content.Title = content.FullTitle = title;

                _form.DockingManager.ShowContent(content);
                if (content.IsAutoHidden && hint != ShelfDisplayHint.HideOnWorkspaceOpen)
                {
                    _form.DockingManager.BringAutoHideIntoView(content);
                }

                return(content);
            }

            content.DisplaySize  = displaySize;
            content.AutoHideSize = displaySize;
            content.FloatingSize = displaySize;

            if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.Container.SuspendLayout();
            }

            // Dock the window on the correct edge
            if ((hint & ShelfDisplayHint.DockTop) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockTop);
            }
            else if ((hint & ShelfDisplayHint.DockBottom) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockBottom);
            }
            else if ((hint & ShelfDisplayHint.DockLeft) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockLeft);
            }
            else if ((hint & ShelfDisplayHint.DockRight) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockRight);
            }
            else
            {
                if ((hint & ShelfDisplayHint.ShowNearMouse) == ShelfDisplayHint.ShowNearMouse)
                {
                    content.DisplayLocation = Control.MousePosition;
                }

                _form.DockingManager.AddContentWithState(content, State.Floating);
            }

            if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.ToggleContentAutoHide(content);
                _form.DockingManager.Container.ResumeLayout();
                _form.DockingManager.BringAutoHideIntoView(content);
            }

            return(content);
        }
Beispiel #14
0
		private static void LaunchShelf(IDesktopWindow desktopWindow, IApplicationComponent component, ShelfDisplayHint shelfDisplayHint)
		{
			IShelf shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleCine, "Cine", shelfDisplayHint);
			Shelves[desktopWindow] = shelf;
			Shelves[desktopWindow].Closed += OnShelfClosed;
		}
Beispiel #15
0
		public static void Show(ShelfDisplayHint displayHint)
		{
			Show(null, displayHint);
		}
Beispiel #16
0
		public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
		{
			if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
				throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);

			desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

			IShelf shelf = GetClipboardShelf(desktopWindow);
			if (shelf != null)
			{
				shelf.Activate();
			}
			else
			{
				Workspace activeWorkspace = desktopWindow.ActiveWorkspace;
				KeyImageInformation info = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation();
				ClipboardComponent component = new KeyImageClipboardComponent(info);
				shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
				shelf.Closed += OnClipboardShelfClosed;

				_clipboardShelves[desktopWindow] = shelf;
			}
		}
Beispiel #17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="component">The <see cref="IApplicationComponent"/> that is to be hosted in the <see cref="Shelf"/>.</param>
 /// <param name="title">The title of the <see cref="Shelf"/>.</param>
 /// <param name="name">A name/identifier for the <see cref="Shelf"/>.</param>
 /// <param name="displayHint">A hint for how the <see cref="Shelf"/> should be initially displayed.</param>
 public ShelfCreationArgs(IApplicationComponent component, [param: Localizable(true)] string title, string name, ShelfDisplayHint displayHint)
     : base(title, name)
 {
     _component   = component;
     _displayHint = displayHint;
 }