private void Button_Click(object sender, RoutedEventArgs e) { { Results StopsResults = new Results(Stops.GetNearStops()); this.NavigationService.Navigate(StopsResults); } }
public void GetNearStopsTest() { FakeStopsProvider fakeStopsProvider = new FakeStopsProvider(); Stops.StopsProvider = fakeStopsProvider; Stop.LinesProvider = fakeStopsProvider; string stopsModel = System.IO.File.ReadAllText(@"./../../StopsModel.txt"); string linesModel = System.IO.File.ReadAllText(@"./../../linesModel.txt"); fakeStopsProvider.StopsToReturn = stopsModel; fakeStopsProvider.LinesToReturn = linesModel; Stops target = new Stops(); List <Stop> result = target.GetNearStops(); // No Stop duplicated Assert.AreEqual(2, result.Count); // No Lines duplicated Assert.AreEqual(4, result[0].Lines.Count); // Synchro on Lines & LinesId Assert.AreEqual(result[0].Lines.Length, result[0].Lines.Count); // No wierd effect when not duplicated Assert.AreEqual(4, result[1].Lines.Count); }
private void Button_Click(object sender, RoutedEventArgs e) { pinLayer.Children.Clear(); lineLayer.Children.Clear(); lineLabelLayer.Children.Clear(); stopLabelLayer.Children.Clear(); circleLayer.Children.Clear(); MetroMap.Center = NearStopsUri.CenterLocation; DrawCircle(NearStopsUri.CenterLocation, NearStopsUri.Dist); List <Stop> StopsResults = Stops.GetNearStops(); if (StopsResults.Count > 0) { foreach (Stop stop in StopsResults) { Location pinLocation = new Location(stop.Lat, stop.Lon); TextBlock label = new TextBlock() { Text = stop.ToString(), Background = new SolidColorBrush(Colors.AliceBlue), FontSize = 12, Padding = new Thickness(5), }; Image busIcon = new Image() { Source = new BitmapImage(new Uri("./images/bus_symbol.png", UriKind.Relative)) }; Pushpin pin = new Pushpin { Location = pinLocation, DataContext = label, Content = busIcon, }; pin.MouseEnter += new MouseEventHandler(StopMouseEnter); pin.MouseLeave += new MouseEventHandler(StopMouseLeave); pinLayer.Children.Add(pin); } foreach (MetroApp.Line line in Stops.LineCollection) { DrawLine(line); } } }