Пример #1
0
 public void OpenMaps(Station station)
 {
     try
     {
         var manufacturer = string.Empty;
         object temp;
         if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out temp))
             manufacturer = temp.ToString();
         if (manufacturer.Equals("NOKIA"))
         {
             try
             {
                 OpenHereMaps(station);
             }
             catch (Exception)
             {
                 OpenDefaultmaps(station);
             }
         }
         else
         {
             OpenDefaultmaps(station);
         }
     }
     catch (Exception)
     {
         //TODO: handle this, guide the user to doznload a maps app?
     }
 }
Пример #2
0
 private void OpenDefaultmaps(Station station)
 {
     var bingMapsDirectionsTask = new BingMapsDirectionsTask();
     var mapLocation = new LabeledMapLocation(string.Format(AppResources.NavigationStation, station.Name), station.GeoCoordinate);
     bingMapsDirectionsTask.End = mapLocation;
     // If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point.
     bingMapsDirectionsTask.Show();
 }
Пример #3
0
 private async void GetLiveBoard(Station station)
 {
     try
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             Departures.Clear();
             LoadingDepartures = true;
         });
         var list = await RailService.GetInstance().GetLiveBoard(station);
         if (list == null)
         {
             Message.ShowToast(AppResources.MessageStationInfoError);
             return;
         }
         _helper.AssignList(Departures, list);
         Deployment.Current.Dispatcher.BeginInvoke(() => LoadingDepartures = false);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Пример #4
0
 public async Task<List<Departure>> GetLiveBoard(Station station)
 {
     if(!station.Id.Contains(":"))
     {
         return 
             await 
                 Client.GetInstance()
                     .GetLiveBoard(new[]
                     {
                         new KeyValuePair<string, string>(Arguments.Id.ToString().ToLower(), station.Id), 
                         new KeyValuePair<string, string>(Arguments.Lang.ToString().ToLower(), AppResources.ClientLang)
                     } );
     }
     //var time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(station.Id.Split(':')[0]), int.Parse(station.Id.Split(':')[1]), 0);
     return
         await
             Client.GetInstance()
                 .GetLiveBoard(new[]
                 {
                     new KeyValuePair<string, string>(Arguments.Station.ToString(), station.Name.ToUpper()),
                     new KeyValuePair<string, string>(Arguments.Lang.ToString().ToLower(),AppResources.ClientLang),
                     new KeyValuePair<string, string>(Arguments.Date.ToString().ToLower(),DateTime.Now.ToShortDateString().ConvertDateToCorrectDateStamp()),
                     new KeyValuePair<string, string>(Arguments.Time.ToString().ToLower(),station.Id.Remove(station.Id.IndexOf(':'), 1))
                 });
 }
Пример #5
0
 private void OpenHereMaps(Station station)
 {
     var routeTo = new DirectionsRouteDestinationTask
     {
         Destination = station.GeoCoordinate,
         Mode = RouteMode.Unknown
     };
     routeTo.Show();
 }