コード例 #1
0
        public static AnnotationEntity Create(string annotation)
        {
            XDocument doc = XDocument.Parse(annotation);
            var       documentAnnotations = new List <AnnotationEntity>();

            var annotationEntity = new AnnotationEntity
                                   (
                annotation
                                   );

            doc.Descendants("Container").ToList().ForEach(container =>
            {
                container.Descendants("Object").ToList().ForEach(annotationObject =>
                {
                    var annotationObjectEntity = new AnnotationObjectEntity
                                                 (
                        Guid.Parse(annotationObject.Element("Guid").Value.ToString()),
                        Convert.ToInt32(container.Element("PageNumber").Value.ToString()),
                        true
                                                 );

                    annotationEntity.AddAnnotation(annotationObjectEntity);
                });
            });

            return(annotationEntity);
        }
コード例 #2
0
        public string AddAnnotation()
        {
            var annotationXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Annotations><Version>1</Version><Container><PageNumber>1</PageNumber><Size><Width>6120</Width><Height>7920</Height></Size><Offset><X>0</X><Y>0</Y></Offset><CalibrationScale>1</CalibrationScale><IsVisible>true</IsVisible><IsEnabled>true</IsEnabled><ViewPerspective>1</ViewPerspective><RotateAngle>0</RotateAngle><UserData/><CalibrationUnit>Inch</CalibrationUnit><Objects><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Object><ObjectType>Leadtools.Annotations.Engine.AnnHiliteObject</ObjectType><AssemblyName/><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Guid>8ba222a3-5cb1-4772-9657-224bfc640fb7</Guid><IsVisible>true</IsVisible><IsSelected>false</IsSelected><IsLocked>false</IsLocked><Password/><GroupName/><Hyperlink>https://www.leadtools.com</Hyperlink><FixedStateOperations>0</FixedStateOperations><RotateGripper>240</RotateGripper><RotateCenter><X>2412.2001950404</X><Y>2706.1855670103087</Y></RotateCenter><Points><Point><X>844.9112566174415</X><Y>2173.307327946503</Y></Point><Point><X>3979.4891334633585</X><Y>2173.307327946503</Y></Point><Point><X>3979.4891334633585</X><Y>3239.063806074115</Y></Point><Point><X>844.9112566174415</X><Y>3239.063806074115</Y></Point></Points><Fill><SolidColorBrush><Color>transparent</Color></SolidColorBrush></Fill><Labels><Label><Key>AnnObjectName</Key><IsVisible>false</IsVisible><LabelRestriction>0</LabelRestriction><Text/><OriginalPosition><X>844.9112566174415</X><Y>2173.307327946503</Y></OriginalPosition><Offset><X>0</X><Y>0</Y></Offset><Background/><Foreground><SolidColorBrush><Color>red</Color></SolidColorBrush></Foreground><Font><FamilyName>Arial</FamilyName><Size>11</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><OffsetHeight>true</OffsetHeight><LabelPositionMode>0</LabelPositionMode></Label></Labels><Stroke><Fill><SolidColorBrush><Color>red</Color></SolidColorBrush></Fill><Thickness>1</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Inset</StrokeAlignment></Stroke><SelectionStroke><Fill><SolidColorBrush><Color>Blue</Color></SolidColorBrush></Fill><Thickness>4</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Center</StrokeAlignment></SelectionStroke><Font><FamilyName>Arial</FamilyName><Size>12</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><ObjectId>-11</ObjectId><ObjectTag/><Metadata><Item><Key>Subject</Key><Value/></Item><Item><Key>Author</Key><Value>Author</Value></Item><Item><Key>Modified</Key><Value>2020-03-24T10:03:07.695Z</Value></Item><Item><Key>Title</Key><Value/></Item><Item><Key>Content</Key><Value/></Item><Item><Key>Created</Key><Value>2020-03-24T10:03:07.688Z</Value></Item></Metadata><Reviews/><UserId/><LayerId/><Opacity>1</Opacity><BorderStyle>0</BorderStyle><Color>yellow</Color></Object></Objects></Container><Container><PageNumber>2</PageNumber><Size><Width>6120</Width><Height>7920</Height></Size><Offset><X>0</X><Y>0</Y></Offset><CalibrationScale>1</CalibrationScale><IsVisible>true</IsVisible><IsEnabled>true</IsEnabled><ViewPerspective>1</ViewPerspective><RotateAngle>0</RotateAngle><UserData/><CalibrationUnit>Inch</CalibrationUnit><Objects><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Object><ObjectType>Leadtools.Annotations.Engine.AnnRubberStampObject</ObjectType><AssemblyName/><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Guid>c79662be-b3d3-4eb3-8513-a39c5513895f</Guid><IsVisible>true</IsVisible><IsSelected>false</IsSelected><IsLocked>false</IsLocked><Password/><GroupName/><Hyperlink>https://www.leadtools.com</Hyperlink><FixedStateOperations>0</FixedStateOperations><RotateGripper>240</RotateGripper><RotateCenter><X>2548.0319030370565</X><Y>5851.212036779047</Y></RotateCenter><Points><Point><X>970.2943716912778</X><Y>5328.78239063806</Y></Point><Point><X>4125.769434382835</X><Y>5328.78239063806</Y></Point><Point><X>4125.769434382835</X><Y>6373.6416829200325</Y></Point><Point><X>970.2943716912778</X><Y>6373.6416829200325</Y></Point></Points><Fill/><Labels><Label><Key>AnnObjectName</Key><IsVisible>false</IsVisible><LabelRestriction>0</LabelRestriction><Text/><OriginalPosition><X>970.2943716912778</X><Y>5328.78239063806</Y></OriginalPosition><Offset><X>0</X><Y>0</Y></Offset><Background/><Foreground><SolidColorBrush><Color>red</Color></SolidColorBrush></Foreground><Font><FamilyName>Arial</FamilyName><Size>11</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><OffsetHeight>true</OffsetHeight><LabelPositionMode>0</LabelPositionMode></Label></Labels><Stroke><Fill><SolidColorBrush><Color>red</Color></SolidColorBrush></Fill><Thickness>1</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Inset</StrokeAlignment></Stroke><SelectionStroke><Fill><SolidColorBrush><Color>Blue</Color></SolidColorBrush></Fill><Thickness>4</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Center</StrokeAlignment></SelectionStroke><Font><FamilyName>Arial</FamilyName><Size>12</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><ObjectId>-17</ObjectId><ObjectTag/><Metadata><Item><Key>Subject</Key><Value/></Item><Item><Key>Author</Key><Value>Author</Value></Item><Item><Key>Modified</Key><Value>2020-03-24T10:03:18.766Z</Value></Item><Item><Key>Title</Key><Value/></Item><Item><Key>Content</Key><Value/></Item><Item><Key>Created</Key><Value>2020-03-24T10:03:18.760Z</Value></Item></Metadata><Reviews/><UserId/><LayerId/><Opacity>1</Opacity><BorderStyle>0</BorderStyle><RubberStampType>StampApproved</RubberStampType></Object></Objects></Container><Container><PageNumber>3</PageNumber><Size><Width>6120</Width><Height>7920</Height></Size><Offset><X>0</X><Y>0</Y></Offset><CalibrationScale>1</CalibrationScale><IsVisible>true</IsVisible><IsEnabled>true</IsEnabled><ViewPerspective>1</ViewPerspective><RotateAngle>0</RotateAngle><UserData/><CalibrationUnit>Inch</CalibrationUnit><Objects><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Object><ObjectType>Leadtools.Annotations.Engine.AnnRubberStampObject</ObjectType><AssemblyName/><OnLoad><RotateAngle>0</RotateAngle><ScaleX>1</ScaleX><ScaleY>1</ScaleY><Offset><X>0</X><Y>0</Y></Offset></OnLoad><Guid>aa2e7594-f022-415e-b2d7-fb3d4dc853dd</Guid><IsVisible>true</IsVisible><IsSelected>true</IsSelected><IsLocked>false</IsLocked><Password/><GroupName/><Hyperlink>https://www.leadtools.com</Hyperlink><FixedStateOperations>0</FixedStateOperations><RotateGripper>240</RotateGripper><RotateCenter><X>5055.69420451379</X><Y>6822.931178601281</Y></RotateCenter><Points><Point><X>4167.563806074113</X><Y>6290.052939537475</Y></Point><Point><X>5943.824602953468</X><Y>6290.052939537475</Y></Point><Point><X>5943.824602953468</X><Y>7355.8094176650875</Y></Point><Point><X>4167.563806074113</X><Y>7355.8094176650875</Y></Point></Points><Fill/><Labels><Label><Key>AnnObjectName</Key><IsVisible>false</IsVisible><LabelRestriction>0</LabelRestriction><Text/><OriginalPosition><X>4167.563806074113</X><Y>6290.052939537475</Y></OriginalPosition><Offset><X>0</X><Y>0</Y></Offset><Background/><Foreground><SolidColorBrush><Color>red</Color></SolidColorBrush></Foreground><Font><FamilyName>Arial</FamilyName><Size>11</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><OffsetHeight>true</OffsetHeight><LabelPositionMode>0</LabelPositionMode></Label></Labels><Stroke><Fill><SolidColorBrush><Color>red</Color></SolidColorBrush></Fill><Thickness>1</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Inset</StrokeAlignment></Stroke><SelectionStroke><Fill><SolidColorBrush><Color>Blue</Color></SolidColorBrush></Fill><Thickness>4</Thickness><MiterLimit>0</MiterLimit><DashCap>Flat</DashCap><StartLineCap>Round</StartLineCap><EndLineCap>Round</EndLineCap><LineJoin>Round</LineJoin><DashOffset>0</DashOffset><Dashes/><StrokeAlignment>Center</StrokeAlignment></SelectionStroke><Font><FamilyName>Arial</FamilyName><Size>12</Size><Stretch>Normal</Stretch><Weight>Normal</Weight><Style>Normal</Style><TextDecoration>0</TextDecoration></Font><ObjectId>-17</ObjectId><ObjectTag/><Metadata><Item><Key>Subject</Key><Value/></Item><Item><Key>Author</Key><Value>Author</Value></Item><Item><Key>Modified</Key><Value>2020-03-24T10:03:30.132Z</Value></Item><Item><Key>Title</Key><Value/></Item><Item><Key>Content</Key><Value/></Item><Item><Key>Created</Key><Value>2020-03-24T10:03:30.129Z</Value></Item></Metadata><Reviews/><UserId/><LayerId/><Opacity>1</Opacity><BorderStyle>0</BorderStyle><RubberStampType>StampChecked</RubberStampType></Object></Objects></Container></Annotations>";

            var annotation = AnnotationEntity.Create(annotationXml);

            _context.Annotation.Add(annotation);
            _context.SaveChanges();

            return("OK");
        }