Esempio n. 1
0
        /// <summary>
        /// Opens a new workspace.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public Workspace AddNew(WorkspaceCreationArgs args)
        {
            Workspace workspace = CreateWorkspace(args);

            Open(workspace);
            return(workspace);
        }
Esempio n. 2
0
        private Workspace CreateWorkspace(WorkspaceCreationArgs args)
        {
            IWorkspaceFactory factory = CollectionUtils.FirstElement <IWorkspaceFactory>(
                (new WorkspaceFactoryExtensionPoint()).CreateExtensions()) ?? new DefaultWorkspaceFactory();

            return(factory.CreateWorkspace(args, _owner));
        }
Esempio n. 3
0
        /// <summary>
        /// Executes the specified application component in a new workspace.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from the <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 workspace will run.</param>
        /// <param name="creationArgs">A <see cref="WorkspaceCreationArgs"/> object.</param>
        /// <returns>The workspace that is hosting the component.</returns>
        public static Workspace LaunchAsWorkspace(
            IDesktopWindow desktopWindow,
            WorkspaceCreationArgs creationArgs)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(creationArgs, "creationArgs");

            return(LaunchAsWorkspace(desktopWindow, creationArgs, null));
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="args">Arguments for creation of the <see cref="Workspace"/>.</param>
 /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the <see cref="Workspace"/>.</param>
 protected internal Workspace(WorkspaceCreationArgs args, DesktopWindow desktopWindow)
     : base(args)
 {
     _commandHistory = new CommandHistory(100);
     _desktopWindow  = desktopWindow;
     _userClosable   = args.UserClosable;
     _dialogBoxes    = new WorkspaceDialogBoxCollection(this);
     _host           = new Host(this, args.Component);
 }
Esempio n. 5
0
        public static Workspace LaunchAsWorkspace(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title,
            ApplicationComponentExitDelegate exitCallback)
        {
            var args = new WorkspaceCreationArgs(component, title, null);

            return(LaunchAsWorkspace(desktopWindow, args, exitCallback));
        }
Esempio n. 6
0
        /// <summary>
        /// Executes the specified application component in a new workspace.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from the <see cref="Start"/> method, that exception
        /// will be propagated to the caller of this method and the component will not be launched.
        /// </remarks>
        /// <param name="desktopWindow">The desktop window in which the workspace will run.</param>
        /// <param name="component">The application component to launch.</param>
        /// <param name="title">The title of the workspace.</param>
        /// <returns>The workspace that is hosting the component.</returns>
        public static Workspace LaunchAsWorkspace(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(component, "component");

            var args = new WorkspaceCreationArgs(component, title, null);

            return(LaunchAsWorkspace(desktopWindow, args, null));
        }
Esempio n. 7
0
        public static Workspace LaunchAsWorkspace(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title,
            string name,
            ApplicationComponentExitDelegate exitCallback)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(component, "component");

            var args = new WorkspaceCreationArgs(component, title, name);

            return(LaunchAsWorkspace(desktopWindow, args, exitCallback));
        }
Esempio n. 8
0
        /// <summary>
        /// Private helper method to support LaunchAsWorkspace.
        /// </summary>
        private static Workspace LaunchAsWorkspace(
            IDesktopWindow desktopWindow,
            WorkspaceCreationArgs creationArgs,
            ApplicationComponentExitDelegate exitCallback)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(creationArgs, "creationArgs");

            var workspace = desktopWindow.Workspaces.AddNew(creationArgs);

            if (exitCallback != null)
            {
                workspace.Closed += ((sender, e) => exitCallback(creationArgs.Component));
            }
            return(workspace);
        }
Esempio n. 9
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="args">Arguments for creation of the <see cref="Workspace"/>.</param>
		/// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the <see cref="Workspace"/>.</param>
		protected internal Workspace(WorkspaceCreationArgs args, DesktopWindow desktopWindow)
			: base(args)
		{
			_commandHistory = new CommandHistory(100);
			_desktopWindow = desktopWindow;
			_userClosable = args.UserClosable;
			_dialogBoxes = new WorkspaceDialogBoxCollection(this);
			_host = new Host(this, args.Component);
		}
Esempio n. 10
0
 public Workspace CreateWorkspace(WorkspaceCreationArgs args, DesktopWindow window)
 {
     return(new Workspace(args, window));
 }