Exemplo n.º 1
0
        private void SetReadOnly(Document document)
        {
            SessionReadOnlyReason sessionReason;
            ProjectReadOnlyReason projectReason;

            SetReadOnly(document.Id, _encService.IsProjectReadOnly(document.Project.Name, out sessionReason, out projectReason));
        }
        private void SetReadOnly(Document document)
        {
            // Only set documents read-only if they're part of a project that supports Enc.
            var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
            var project   = workspace?.ProjectTracker?.GetProject(document.Project.Id);

            if (project?.EditAndContinueImplOpt != null)
            {
                SetReadOnly(document.Id, _encService.IsProjectReadOnly(document.Project.Id, out var sessionReason, out var projectReason) && AllowsReadOnly(document.Id));
            }
        }
Exemplo n.º 3
0
        private bool IsRegionReadOnly(DocumentId documentId, bool isEdit)
        {
            AssertIsForeground();
            bool isReadOnly = _encService.IsProjectReadOnly(documentId.ProjectId, out var sessionReason, out var projectReason);

            if (isEdit && isReadOnly)
            {
                _onReadOnlyDocumentEditAttempt?.Invoke(documentId, sessionReason, projectReason);
            }

            return(isReadOnly);
        }
Exemplo n.º 4
0
        private void SetReadOnly(Document document)
        {
            // Only set documents read-only if they're part of a project that supports Enc.
            var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
            var project   = workspace?.ProjectTracker?.GetProject(document.Project.Id) as AbstractRoslynProject;

            if (project != null)
            {
                SessionReadOnlyReason sessionReason;
                ProjectReadOnlyReason projectReason;
                SetReadOnly(document.Id, _encService.IsProjectReadOnly(document.Project.Id, out sessionReason, out projectReason) && AllowsReadOnly(document.Id));
            }
        }
Exemplo n.º 5
0
        private bool IsRegionReadOnly(DocumentId documentId, bool isEdit)
        {
            AssertIsForeground();

            SessionReadOnlyReason sessionReason;
            ProjectReadOnlyReason projectReason;
            bool isReadOnly = _encService.IsProjectReadOnly(documentId.ProjectId, out sessionReason, out projectReason);

            if (isEdit && isReadOnly)
            {
                if (_onReadOnlyDocumentEditAttempt != null)
                {
                    _onReadOnlyDocumentEditAttempt(documentId, sessionReason, projectReason);
                }
            }

            return(isReadOnly);
        }
Exemplo n.º 6
0
        private bool IsRegionReadOnly(DocumentId documentId, bool isEdit)
        {
            AssertIsForeground();

            var document = _workspace.CurrentSolution.GetDocument(documentId);

            Debug.Assert(document != null);

            SessionReadOnlyReason sessionReason;
            ProjectReadOnlyReason projectReason;
            bool isReadOnly = _encService.IsProjectReadOnly(document.Project.Name, out sessionReason, out projectReason);

            if (isEdit && isReadOnly)
            {
                if (_onReadOnlyDocumentEditAttempt != null)
                {
                    _onReadOnlyDocumentEditAttempt(documentId, sessionReason, projectReason);
                }
            }

            return(isReadOnly);
        }