Example #1
0
        async public void funcparse()
        {
            i++;
            HttpClient httpClient     = new HttpClient();
            string     ResponseString = await httpClient.GetStringAsync(URI + "/getleaderlocation?" + "gid=" + gid + "&i=" + i);

            if (ResponseString != "")
            {
                JObject j  = JsonConvert.DeserializeObject <JObject>(ResponseString);
                JArray  ja = (JArray)j["data"];
                //Debug.WriteLine(ja.Count);

                foreach (JObject jj in ja)
                {
                    leaderdata mm = new leaderdata()
                    {
                        accuracy = (double)jj["accuracy"],
                        uname    = (string)jj["username"],
                        lat      = (double)jj["lat"],
                        lon      = (double)jj["lon"]
                    };
                    //Debug.WriteLine(mm.uname);
                }
            }
            else
            {
                MessageDialog m1 = new MessageDialog("NHP");
                await m1.ShowAsync();
            }
        }
Example #2
0
        public async void displayleader(double para1, double para2)
        {
            i++;
            HttpClient httpClient     = new HttpClient();
            string     ResponseString = await httpClient.GetStringAsync(URI + "/getleaderlocation?gid=" + gid + "&j=" + i);

            if (ResponseString != "")
            {
                JObject j  = JsonConvert.DeserializeObject <JObject>(ResponseString);
                JArray  ja = (JArray)j["data"];
                //Debug.WriteLine(ja.Count);

                foreach (JObject jj in ja)
                {
                    leaderdata mm = new leaderdata()
                    {
                        accuracy = (double)jj["accuracy"],
                        uname    = (string)jj["username"],
                        lat      = (double)jj["lat"],
                        lon      = (double)jj["lon"]
                    };
                    //Debug.WriteLine(mm.uname);

                    var jayway = new Geopoint(new BasicGeoposition()
                    {
                        Latitude = mm.lat, Longitude = mm.lon
                    });

                    MapIcon mapIcon = new MapIcon();
                    mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/reddot.png"));
                    mapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
                    mapIcon.Location = jayway;
                    mapIcon.Title    = mm.uname;
                    map1.MapElements.Add(mapIcon);

                    if (DistanceTo(para1, para2, jayway.Position.Latitude, jayway.Position.Longitude) > radius)
                    {
                        MessageDialog m = new MessageDialog("You have gone out of range");
                        await m.ShowAsync();
                    }
                }
            }

            else
            {
                MessageDialog m1 = new MessageDialog("NHP");
                await m1.ShowAsync();
            }
        }
Example #3
0
        async public void funcparse()
        {
            i++;
            HttpClient httpClient = new HttpClient();
            string ResponseString = await httpClient.GetStringAsync(URI + "/getleaderlocation?" + "gid=" + gid + "&i="+i);

            if (ResponseString != "")
            {
                JObject j = JsonConvert.DeserializeObject<JObject>(ResponseString);
                JArray ja = (JArray)j["data"];
                //Debug.WriteLine(ja.Count);

                foreach (JObject jj in ja)
                {
                    leaderdata mm = new leaderdata()
                    {
                        accuracy = (double)jj["accuracy"],
                        uname = (string)jj["username"],
                        lat = (double)jj["lat"],
                        lon = (double)jj["lon"]
                    };
                    //Debug.WriteLine(mm.uname);
                }

            }
            else
            {
                MessageDialog m1 = new MessageDialog("NHP");
                await m1.ShowAsync();
            }
        }
Example #4
0
        public async void displayleader(double para1, double para2)
        {
            i++;
            HttpClient httpClient = new HttpClient();
            string ResponseString = await httpClient.GetStringAsync(URI + "/getleaderlocation?gid="+gid+"&j="+i);

            if (ResponseString != "")
            {
                JObject j = JsonConvert.DeserializeObject<JObject>(ResponseString);
                JArray ja = (JArray)j["data"];
                //Debug.WriteLine(ja.Count);

                foreach (JObject jj in ja)
                {
                    leaderdata mm = new leaderdata()
                    {
                        accuracy = (double)jj["accuracy"],
                        uname = (string)jj["username"],
                        lat = (double)jj["lat"],
                        lon = (double)jj["lon"]
                    };
                    //Debug.WriteLine(mm.uname);

                    var jayway = new Geopoint(new BasicGeoposition() { Latitude = mm.lat, Longitude = mm.lon });

                    MapIcon mapIcon = new MapIcon();
                    mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/reddot.png"));
                    mapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
                    mapIcon.Location = jayway;
                    mapIcon.Title = mm.uname;
                    map1.MapElements.Add(mapIcon);

                    if (DistanceTo(para1, para2, jayway.Position.Latitude, jayway.Position.Longitude) > radius)
                    {
                        MessageDialog m = new MessageDialog("You have gone out of range");
                        await m.ShowAsync();
                    }
                }

            }

            else
            {
                MessageDialog m1 = new MessageDialog("NHP");
                await m1.ShowAsync();
            }

        }