public static ProductAnnotation Parse([NotNull] FileInfo fileInfo, [CanBeNull] Checksum checkSum)
        {
            Guard.NotNullAndValidFileSystemInfo(fileInfo, nameof(fileInfo));

            var productAnnotation = new ProductAnnotation
            {
                File     = fileInfo,
                Checksum = checkSum
            };

            using (var fileStream = new FileStream(fileInfo.FullName, FileMode.Open))
            {
                var document = new XmlDocument();
                document.Load(fileStream);

                productAnnotation.RawXml = document.InnerXml;

                var productNode = document.SelectSingleNodeThrowIfNull("product");

                productAnnotation.AdsHeader          = AdsHeaderParser.Parse(productNode.SelectSingleNodeThrowIfNull("adsHeader"));
                productAnnotation.QualityInformation = QualityInformationParser.Parse(productNode.SelectSingleNodeThrowIfNull("qualityInformation"));
                productAnnotation.GeneralAnnotation  = GeneralAnnotationParser.Parse(productNode.SelectSingleNodeThrowIfNull("generalAnnotation"));
            }

            return(productAnnotation);
        }
Exemplo n.º 2
0
        private MKAnnotationView getViewForProductAnnotation(MKMapView mapView, ProductAnnotation annotation)
        {
            var annotationId = "ProductAnnotation";
            var annotationView = getAvaiableAnnotationView(annotationId,MKPinAnnotationColor.Red, annotation);
            if(!string.IsNullOrWhiteSpace(annotation.Product.IconImageUri))
                annotationView.LeftCalloutAccessoryView = new UIWebImageView(annotationView.Frame, annotation.Product.IconImageUri);
            annotationView.RightCalloutAccessoryView = UIButton.FromType(UIButtonType.DetailDisclosure);

            return annotationView;
        }