コード例 #1
0
        }                                   //distance


        private void Button_Click(object sender, RoutedEventArgs e)

        {
            carte.Children.Clear();
            Xvalide = lon.Text;
            Yvalide = lat.Text;
            Zvalide = dist.Text;
            // MessageBox.Show("Bonjour");
            try
            {
                List <StructureJson> donnees = MetroLib.GetBus("http://data.metromobilite.fr/api/linesNear/json?x=" + Xvalide + "&y=" + Yvalide + "&dist=" + Zvalide + "&details=true");

                List <StructureJson> ArretSansDouble = donnees.GroupBy(n => n.Name).Select(grp => grp.First()).ToList();



                foreach (StructureJson donnee in ArretSansDouble)
                {
                    /*pour chaque élement de la structureJson dans données on récupère
                     * dans la variable donnee, id, nom... et on affiche*/

                    Pushpin  Ici      = new Pushpin();
                    Location location = new Location(donnee.Lat, donnee.Lon);
                    Ici.Location = location;
                    carte.Children.Add(Ici);
                    Result.Items.Add(donnee.Name);


                    //Console.WriteLine("\nArrêt" + " " + donnee.Name

                    //    + "\nLongitude " + " " + donnee.lon
                    //    + "\nLatitude " + " " + donnee.lat + "\n"
                    //    + "\nLignes" + " " + donnee.id);

                    //les lignes de bus comportant un tableau, on refait un foreach
                    foreach (string line in donnee.Lines)
                    {
                        //Console.WriteLine("Lignes" + " " + line);
                    }
                }
            }

            catch (Exception ex)
            {
                Result.Items.Add("Numbers Only. Press reset to try again!");
                Console.WriteLine(ex.GetType().FullName);
            }
        }
コード例 #2
0
 public void Test_NewPushPin_AvecTitreNull_LeveException()
 {
     Pushpin pin = new Pushpin(null, null);
 }