Esempio n. 1
0
        public async Task <IWorkspaceProjectContext> CreateProjectContextAsync(ConfiguredProject project)
        {
            Requires.NotNull(project, nameof(project));

            ProjectContextInitData data = await GetProjectContextInitDataAsync(project);

            if (data.IsInvalid())
            {
                return(null);
            }

            object hostObject = _project.Services.HostObject;

            IWorkspaceProjectContext context = await CreateProjectContextHandlingFaultAsync(data, hostObject);

            if (context == null)
            {
                return(null);
            }

            // Wrap to enforce UI-thread
            context = new ForegroundWorkspaceProjectContext(_threadingService, context);

            _activeWorkspaceProjectContextTracker.RegisterContext(context, data.WorkspaceProjectContextId);

            return(context);
        }
        public async Task <IWorkspaceProjectContextAccessor?> CreateProjectContextAsync(ConfiguredProject project)
        {
            Requires.NotNull(project, nameof(project));

            ProjectContextInitData data = await GetProjectContextInitDataAsync(project);

            if (data.IsInvalid())
            {
                return(null);
            }

            object?hostObject = _project.Services.HostObject;

            IWorkspaceProjectContext?context = await CreateProjectContextHandlingFaultAsync(data, hostObject);

            if (context == null)
            {
                return(null);
            }

            return(new WorkspaceProjectContextAccessor(data.WorkspaceProjectContextId, context));
        }