Пример #1
0
        private void StartPostComment()
        {
            if (Current.Instance.Earthwatcher == null)
            {
                var warning = new WarningScreen(Labels.Comments4);
                warning.Show();
                return;
            }

            if (txtComment.Text.Trim().Equals(""))
            {
                return;
            }

            var comment = new Earthwatchers.Models.Comment
            {
                FullName       = Current.Instance.Earthwatcher.FullName,
                Published      = DateTime.UtcNow,
                UserName       = Current.Instance.Username,
                EarthwatcherId = Current.Instance.Earthwatcher.Id,
                LandId         = landId,
                UserComment    = txtComment.Text,
            };

            commentRequests.Post(comment, Current.Instance.Username, Current.Instance.Password);

            txtComment.Text = "";

            comment.Published = DateTime.UtcNow;
            comments.Insert(0, comment);
        }
Пример #2
0
        public static void ZoomToHexagon(MapControl mapcontrol, string geohex)
        {
            var zone = GeoHex.Decode(geohex);

            if (zone == null)
            {
                var ws = new WarningScreen("Sorry this land is not available");
                ws.Show();
                return;
            }

            var       coordinates          = zone.getHexCoords();
            var       sphericalTopLeft     = SphericalMercator.FromLonLat(coordinates[0].Longitude, coordinates[1].Latitude);
            var       sphericalBottomRight = SphericalMercator.FromLonLat(coordinates[3].Longitude, coordinates[4].Latitude);
            const int marge = 8000;

            mapcontrol.ZoomToBox(new Mapsui.Geometries.Point(sphericalTopLeft.x - marge, sphericalTopLeft.y - marge), new Mapsui.Geometries.Point(sphericalBottomRight.x + marge, sphericalBottomRight.y + marge));

            //TODO: Blergh awfull dirty dirty hack to show hexagon after zoomToHexagon (problem = Extend is a center point after ZoomToBox)
            mapcontrol.ZoomIn();
            mapcontrol.ZoomOut();

            var hexLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);

            hexLayer.UpdateHexagonsInView();
            Current.Instance.MapControl.OnViewChanged(true);
        }
Пример #3
0
        private void StartPostComment()
        {
            if (Current.Instance.Earthwatcher == null)
            {
                var warning = new WarningScreen("You are not logged in");
                warning.Show();
                return;
            }

            if (txtComment.Text.Trim().Equals(""))
                return;

            var comment = new Earthwatchers.Models.Comment
            {
                FullName = Current.Instance.Earthwatcher.FullName,
                Published = DateTime.Now,
                UserName = Current.Instance.Username,
                EarthwatcherId = Current.Instance.Earthwatcher.Id,
                LandId = landId,
                UserComment = txtComment.Text,               
            };

            commentRequests.Post(comment, Current.Instance.Username,Current.Instance.Password);

            txtComment.Text = "";

            comment.Published = DateTime.Now;
            comments.Insert(0, comment);
        }
Пример #4
0
 void DownloadTexturePack( WarningScreen screen )
 {
     DownloadTexturePack( ((string)screen.Metadata).Substring( 3 ) );
 }
Пример #5
0
        protected void WarningScreenTick( WarningScreen screen )
        {
            string identifier = (string)screen.Metadata;
            DownloadedItem item;
            if( !game.AsyncDownloader.TryGetItem( identifier, out item ) || item.Data == null ) return;

            long contentLength = (long)item.Data;
            if( contentLength <= 0 ) return;
            string url = identifier.Substring( 3 );

            float contentLengthMB = (contentLength / 1024f / 1024f );
            string address = url;
            if( url.StartsWith( "https://" ) ) address = url.Substring( 8 );
            if( url.StartsWith( "http://" ) ) address = url.Substring( 7 );
            screen.SetText( "Do you want to download the server's texture pack?",
                           "Texture pack url:", address,
                           "Download size: " + contentLengthMB.ToString( "F3" ) + " MB" );
        }