Example #1
0
        public void DeleteFlag(string flagId)
        {
            if (Current.Instance.Username == null || Current.Instance.Password == null)
                return;

            var fr = new FlagRequests(Constants.BaseApiUrl);
            fr.FlagRemoved += FlagRemoved;
            fr.Delete(flagId, Current.Instance.Username, Current.Instance.Password);
        }
Example #2
0
        public FlagLayer(string name)
            : base(name)
        {
            _source = new MemoryProvider();
            DataSource = _source;
            
            _flagRequest = new FlagRequests(Constants.BaseApiUrl);
            _flagRequest.FlagsReceived += FlagsReceived;
            Current.Instance.MapControl.MouseInfoDown += MapControlMouseInfoDown;
            Current.Instance.MapControl.MouseInfoDownLayers.Add(this);

            RequestFlags();
        }
Example #3
0
        private void BtnOkMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (Current.Instance.Username == null || Current.Instance.Password == null || Current.Instance.Earthwatcher == null)
            {
                var ws = new WarningScreen(Labels.Flag1);
                ws.Show();

                _ignoreClick = true;
                Reset();
                return;
            }
            
            var comment = txtComment.Text;
            var eId = Current.Instance.Earthwatcher.Id;

            //Get lat lon for flag
            var generalTransform = imgFlagShadow.TransformToVisual(Current.Instance.MapControl);
            var childToParentCoordinates = generalTransform.Transform(new Point(15, imgFlagShadow.ActualHeight));
            var spherical = Current.Instance.MapControl.Viewport.ScreenToWorld(childToParentCoordinates.X, childToParentCoordinates.Y);
            var lonLat = SphericalMercator.ToLonLat(spherical.X, spherical.Y);

            //Post
            var flagPost = new FlagRequests(Constants.BaseApiUrl);
            flagPost.FlagAdded += OnFlagAdded;  
            var flag = new Earthwatchers.Models.Flag { Comment = comment, EarthwatcherId = eId, Latitude = lonLat.y, Longitude = lonLat.x };
            flagPost.Post(flag, Current.Instance.Username, Current.Instance.Password);

            _ignoreClick = true;
            Reset();
        }