public ExecutePageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            Title = "Execute Page";

            GetImageCommand.Subscribe(async() =>
            {
                DetectedData.Value = null;

                FaceImageSource.Value = await Media.GetImageToImageSource();
                if (FaceImageSource.Value != null)
                {
                    DetectedData.Value = await Common.ExecuteFaceAPIAsync(APIKey.Value, FaceUriEndPoint, FaceAttributes, FaceImageSource.Value);
                }
            }).AddTo(this.Disposable);

            TakePhotoCommand.Subscribe(async() =>
            {
                DetectedData.Value = null;

                FaceImageSource.Value = await Media.TakePhotoToImageSource();
                if (FaceImageSource.Value != null)
                {
                    DetectedData.Value = await Common.ExecuteFaceAPIAsync(APIKey.Value, FaceUriEndPoint, FaceAttributes, FaceImageSource.Value);
                }
            }).AddTo(this.Disposable);
        }
Beispiel #2
0
        public void OnFragmentNavigation(FirstFloor.ModernUI.Windows.Navigation.FragmentNavigationEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(e.Fragment))
            {
                var uri   = new Uri("http://localhost/?" + e.Fragment);
                var query = System.Web.HttpUtility.ParseQueryString(uri.Query);

                txtImageID.Text  = query.Get("ImageId");
                ViewData.ImageId = Int32.Parse(txtImageID.Text);
                GetImageCommand.Execute(null, btnFetch);
            }
        }
        public Map DrawCountry(GetImageCommand command, Map map, string layerName)
        {
            var       countryGeometry = GeometryFromWKT.Parse(command.CountryLevelWkt);
            IProvider countryProvider = new GeometryFeatureProvider(countryGeometry);

            VectorLayer countryLayer = new VectorLayer(layerName, countryProvider);
            var         borderColor  = System.Drawing.ColorTranslator.FromHtml(command.BorderColor);

            countryLayer.Style.EnableOutline = true;
            countryLayer.Style.Outline       = new Pen(borderColor);
            countryLayer.Style.Outline.Width = command.BorderWidth;
            countryLayer.Style.Fill          = Brushes.Transparent;

            var transformationFactory = new CoordinateTransformationFactory();

            countryLayer.CoordinateTransformation = transformationFactory.CreateFromCoordinateSystems(
                GeographicCoordinateSystem.WGS84,
                ProjectedCoordinateSystem.WebMercator);

            map.Layers.Add(countryLayer);

            map.ZoomToExtents();
            return(map);
        }