// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { ValidateTrialMode(); var multicity = new Multicity(); multicity.Updated += OnLayerUpdated; multicity.LoadPOIs(); this.Resources.Add("multicity", multicity); var driveNow = new DriveNow(); driveNow.Updated += OnLayerUpdated; driveNow.LoadPOIs(); this.Resources.Add("driveNow", driveNow); var car2Go = new Car2Go(); car2Go.Updated += OnLayerUpdated; car2Go.LoadPOIs(); this.Resources.Add("car2go", car2Go); StartFlurry(); UpdateFlipTile( "", "FreeCars", "\n car2go\n DriveNow\n multicity", "Find free rides around you - car2go, DriveNow, multicity", 0, new Uri("/", UriKind.Relative), null, //new Uri("/ApplicationIcon.png", UriKind.Relative), null, null, new Uri("/Resources/wide_back_tile.png", UriKind.Relative), null); var currentVersion = GetAppAttribute("Version"); var lastAppVersion = (string)GetAppSetting("last_version"); if (null != lastAppVersion && lastAppVersion == currentVersion) { IsFirstLaunch = false; } else { IsFirstLaunch = true; } SetAppSetting("last_version", currentVersion); }
void UpdateDriveNowLayer(DriveNow driveNow) { var centerLocation = map.Center; var cultureInfo = new CultureInfo("en-US"); var driveNowBrush = new SolidColorBrush(new Color { A = 255, R = 176, G = 105, B = 9 }); driveNowCarsLayer.Children.Clear(); foreach (var car in driveNow.Markers) { var distanceToMapCenter = (int)car.position.GetDistanceTo(centerLocation); if (markersMaxDistance < distanceToMapCenter) { continue; } //var distance = (int)car.position.GetDistanceTo(myLocationPushpin.Location); var pushpinContent = new Border { Child = new StackPanel { Orientation = System.Windows.Controls.Orientation.Vertical, Children = { new TextBlock { Text = car.model, }, new TextBlock { Text = car.licensePlate, }, new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal, Children = { new Image { Source = new BitmapImage(car.fuelType == "ELE" ? new Uri("/Resources/battery28x28.png", UriKind.Relative) : new Uri("/Resources/fuel28x28.png", UriKind.Relative) ), Margin = new Thickness(0, 0, 12, 0), }, new TextBlock { Text = car.fuelState + "%", }, }, }, }, }, Visibility = Visibility.Collapsed, }; var pushpin = new Pushpin { Location = car.position, Name = car.licensePlate, Background = driveNowBrush, Opacity = .6, Content = pushpinContent, Tag = car, }; pushpin.Tap += OnPushpinTap; try { driveNowCarsLayer.Children.Add(pushpin); } catch (ArgumentException) { } } }