示例#1
0
        private void ClearRelationshipsAndPartFromPackagePart(PackagePart sourcePackagePart, string relationshipType)
        {
            PackageRelationshipCollection relationships = sourcePackagePart.GetRelationshipsByType(relationshipType);

            foreach (var relationship in relationships.ToList())
            {
                sourcePackagePart.DeleteRelationship(relationship.Id);

                if (aasxPackage.PartExists(relationship.TargetUri))
                {
                    aasxPackage.DeletePart(relationship.TargetUri);
                }
            }
        }
示例#2
0
        private void ClearRelationshipAndPartFromPackage(string relationshipType, Uri targetUri)
        {
            PackageRelationshipCollection relationships = aasxPackage.GetRelationshipsByType(relationshipType);

            foreach (var relationship in relationships.ToList())
            {
                if (relationship.TargetUri == targetUri)
                {
                    aasxPackage.DeleteRelationship(relationship.Id);
                }
            }

            if (aasxPackage.PartExists(targetUri))
            {
                aasxPackage.DeletePart(targetUri);
            }
        }