コード例 #1
0
        public static bool IsActiveDocumentChanged(this WorkspaceChangeEventArgs changeEventArgs, Document oldDocument)
        {
            changeEventArgs.ThrowOnNull(nameof(changeEventArgs));

            if (changeEventArgs.Kind != WorkspaceChangeKind.DocumentChanged)
            {
                return(false);
            }

            return(HaveDocumentIdOrProjectIdChanged(changeEventArgs, oldDocument));
        }
コード例 #2
0
        public static bool IsActiveDocumentCleared(this WorkspaceChangeEventArgs changeEventArgs, Document oldDocument)
        {
            changeEventArgs.ThrowOnNull(nameof(changeEventArgs));

            switch (changeEventArgs.Kind)
            {
            case WorkspaceChangeKind.SolutionRemoved:
            case WorkspaceChangeKind.SolutionCleared:
            case WorkspaceChangeKind.SolutionReloaded:
                return(oldDocument?.Project.Solution.Id == changeEventArgs.NewSolution.Id);

            case WorkspaceChangeKind.ProjectRemoved:
            case WorkspaceChangeKind.ProjectReloaded:
                return(oldDocument?.Project.Id == changeEventArgs.ProjectId);

            case WorkspaceChangeKind.DocumentRemoved:
                return(oldDocument?.Id == changeEventArgs.DocumentId);

            default:
                return(false);
            }
        }