Exemple #1
0
        //Ouvrir le menu correspondant à la selection
        private void SelectItem(Location pinLocation)
        {
            for (int i = 0; i < User.Liste.Count(); i++)
            {
                if (User.Liste[i] is IIsPointClose)
                {
                    IIsPointClose coo = User.Liste[i] as IIsPointClose;
                    if (coo.IsPointClose(pinLocation, 0.5))
                    {
                        if (coo is POI poi)
                        {
                            OptPOI text = new OptPOI(poi);
                            text.ShowDialog(); //bloque la page

                            Pushpin pin = map.Children[i] as Pushpin;
                            pin.Location = new Location(poi.Latitude, poi.Longitude);
                            StatBar.Text = "POI updated"; //Affichage dans la StatusBar
                        }
                        else if (coo is Polyline polyl)
                        {
                            OptPolyline text = new OptPolyline(polyl);
                            text.ShowDialog(); //bloque la page

                            MapPolyline tmpPolyl = map.Children[i] as MapPolyline;
                            tmpPolyl.Stroke          = new System.Windows.Media.SolidColorBrush(polyl.Couleur);
                            tmpPolyl.StrokeThickness = polyl.Epaisseur;
                            StatBar.Text             = "Polyline updated"; //Affichage dans la StatusBar
                        }
                        else if (coo is Polygon polyg)
                        {
                            OptPolygon text = new OptPolygon(polyg);
                            text.ShowDialog(); //bloque la page

                            MapPolygon tmpPolyg = map.Children[i] as MapPolygon;
                            tmpPolyg.Stroke  = new System.Windows.Media.SolidColorBrush(polyg.CouleurContour);
                            tmpPolyg.Fill    = new System.Windows.Media.SolidColorBrush(polyg.CouleurRemplissage);
                            tmpPolyg.Opacity = polyg.Opacite;
                            StatBar.Text     = "Polygon updated"; //Affichage dans la StatusBar
                        }
                        else
                        {
                            ErrorWindow error = new ErrorWindow("An error has occurred");
                            error.ShowDialog(); //bloque la page
                        }
                        ReloadList();
                    }
                }
            }
        }
Exemple #2
0
 //Supprimer un item
 private void DeleteItem(Location pinLocation)
 {
     for (int i = 0; i < User.Liste.Count(); i++)
     {
         if (User.Liste[i] is IIsPointClose)
         {
             IIsPointClose coo = User.Liste[i] as IIsPointClose;
             if (coo.IsPointClose(pinLocation, 0.5))
             {
                 ICartoObj cooTmp = coo as ICartoObj;
                 User.Liste.Remove(cooTmp);
                 map.Children.RemoveAt(i);
                 StatBar.Text = "Item deleted"; //Affichage dans la StatusBar
             }
         }
     }
 }