private async void btnTwitter_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var twitter = museo.twitter; if (twitter != null) { //Console.WriteLine(twiter.Remove(0, 20)); System.Diagnostics.Debug.WriteLine(twitter.Remove(0, 20)); var twtt = twitter.Remove(0, 20); //await Launcher.LaunchUriAsync(new Uri("https://mobile.twitter.com/"+twtt)); //MuseoTecdeMty await Launcher.LaunchUriAsync(new Uri("https://mobile.twitter.com/" + twtt)); } else { //canvasTwitter.Opacity = 0; canvasTwitter.Visibility = Visibility.Collapsed; //btnTwitter.Opacity = 0; btnTwitter.Visibility = Visibility.Collapsed; } }
private void Elementos_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Elementos.SelectedItem != null) { Museo museo = (Elementos.SelectedItem as Museo); NavigateServiceExtends.Navigate(NavigationService, new Uri("/FullInfo.xaml", UriKind.RelativeOrAbsolute), museo); } }
/*protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) * { * synth.CancelAll(); * NavigationService.Navigate(new Uri("/PivotPage2.xaml", UriKind.Relative)); * }*/ private async void btnWeb_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var web = museo.web; await Launcher.LaunchUriAsync(new Uri(web)); }
private async void btnRuta_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var nombreMuseo = museo.nombre; var lat = museo.latitud; var lon = museo.longitud; double latitudMuseo; double longitudMuseo; latitudMuseo = Convert.ToDouble(lat); longitudMuseo = Convert.ToDouble(lon); var locator = new Geolocator(); //MessageBox.Show("¿Está seguro de querer abrir Mapas?", "Cómo llegar.",MessageBoxButton.OKCancel); MessageBoxResult m = MessageBox.Show("Trazar una ruta a " + nombreMuseo, "¿Quieres saber cómo llegar?", MessageBoxButton.OKCancel); if (m == MessageBoxResult.Cancel) { } else { //MessageBox.Show("Data Deleted", "Done", MessageBoxButton.OK); String Latitud; String Longitud; if (!locator.LocationStatus.Equals(PositionStatus.Disabled)) { var position = await locator.GetGeopositionAsync(); Latitud = position.Coordinate.Point.Position.Latitude.ToString(); Longitud = position.Coordinate.Point.Position.Longitude.ToString(); } else { return; } double Latitud2 = Convert.ToDouble(Latitud); double Longitud2 = Convert.ToDouble(Longitud); BingMapsDirectionsTask bing = new BingMapsDirectionsTask() { //Giving label and coordinates to starting and ending points. Start = new LabeledMapLocation("Tu posición actual", new GeoCoordinate(Latitud2, Longitud2)), End = new LabeledMapLocation(nombreMuseo, new GeoCoordinate(latitudMuseo, longitudMuseo)) }; // Launching Bing Maps Direction Tasks bing.Show(); } }
private void btnLllamada_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var tel = museo.telefono; var nombre = museo.nombre; PhoneCallTask phoneCallTask = new PhoneCallTask(); phoneCallTask.PhoneNumber = tel; phoneCallTask.DisplayName = nombre; phoneCallTask.Show(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; if (museo != null) { //MessageBox.Show(museo.direccion); } //Ésta línea trae toda la información del museo que se ha seleccionado en otro xaml. // Y la muestra en el xaml actual. this.DataContext = museo; var lat = museo.latitud; var lon = museo.longitud; var fb = museo.facebook; var tw = museo.twitter; var ins = museo.instagram; var web = museo.web; var tel = museo.telefono; System.Diagnostics.Debug.WriteLine("TELEFONO: " + tel); if (tw.Equals("")) { //MessageBox.Show("El museo no tiene twitter"); //canvasTwitter.Opacity = 0; canvasTwitter.Visibility = Visibility.Collapsed; //btnTwitter.Opacity = 0; btnTwitter.Visibility = Visibility.Collapsed; } else if (fb.Equals("")) { canvasFacebook.Visibility = Visibility.Collapsed; btnFacebook.Visibility = Visibility.Collapsed; } else if (web.Equals("")) { canvasWeb.Visibility = Visibility.Collapsed; btnWeb.Visibility = Visibility.Collapsed; } //MessageBox.Show("Se hace llamada al num "+museo.telefono); //horarios.ItemsSource = museo.horarios; //contenido.ItemsSource = museo.descripcionCorta; }
private async void btnAudio_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var descripcion = museo.descripcionCorta; while (audioCount == 0) { audioCount = 1; await synth.SpeakTextAsync(descripcion); //if (audioCount == 1) { synth.CancelAll();break; } } audioCount = 0; //synth.CancelAll(); }
private async void btnAudio_Click(object sender, RoutedEventArgs e) { Piezas pieza = NavigateServiceExtends.GetNavigationData(NavigationService) as Piezas; //this.DataContext = museo; //var descripcion = pieza.descripcion; string id = string.Empty; if (NavigationContext.QueryString.TryGetValue("id", out id)) { System.Diagnostics.Debug.WriteLine("ID de la pieza: " + id); } HttpClient client = new HttpClient(); string json = await client.GetStringAsync(new Uri("http://museosapp.azurewebsites.net/Piezas/" + id)); _piezas = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Piezas> >(json); //_temp = new List<Museo>(); var root = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Piezas> >(json); int index = 0; foreach (var item in root) { /*if (item.categoria.Equals("arte")) * { * _temp.Add(_museos.ElementAt(index)); * System.Diagnostics.Debug.WriteLine(_museos.ElementAt(index).nombre); * System.Diagnostics.Debug.WriteLine(_museos.ElementAt(index).categoria); * System.Diagnostics.Debug.WriteLine("categoria: " + item.categoria); * System.Diagnostics.Debug.WriteLine("indice: " + index); * }*/ var descripcion = item.descripcion; System.Diagnostics.Debug.WriteLine("DESCRIPCION PIEZA: " + descripcion); SpeechSynthesizer synth = new SpeechSynthesizer(); await synth.SpeakTextAsync(descripcion); index++; } }
private async void btnFacebook_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var fbId = museo.facebookid; char[] chars = { 'f', 'b', ':', '/', 'p', 'a', 'g', 'e' }; var fb = fbId.TrimStart(chars); //TrimStart //Remueve caracteres del comienzo de un objeto de cadena existente /*string MyString = "Hello World!"; * char[] MyChar = { 'e', 'H', 'l', 'o', ' ' }; * string NewString = MyString.TrimStart(MyChar); * Console.WriteLine(NewString);*/ await Launcher.LaunchUriAsync(new Uri("fb:pages?id=" + fb)); //await Launcher.LaunchUriAsync(new Uri(fb)); }
private void Elementos_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ElementosArte.SelectedItem != null) { Museo museo = (ElementosArte.SelectedItem as Museo); NavigateServiceExtends.Navigate(NavigationService, new Uri("/FullInfo.xaml", UriKind.RelativeOrAbsolute), museo); } else if (ElementosHistoria.SelectedItem != null) { Museo museo = (ElementosHistoria.SelectedItem as Museo); NavigateServiceExtends.Navigate(NavigationService, new Uri("/FullInfo.xaml", UriKind.RelativeOrAbsolute), museo); } else if (ElementosInteractivo.SelectedItem != null) { Museo museo = (ElementosInteractivo.SelectedItem as Museo); NavigateServiceExtends.Navigate(NavigationService, new Uri("/FullInfo.xaml", UriKind.RelativeOrAbsolute), museo); } /*else if (ElementosHistoria.SelectedItem != null) * { * Museo museoHistoria = (ElementosHistoria.SelectedItem as Museo); * NavigateServiceExtends.Navigate(NavigationService, new Uri("/FullInfo.xaml", UriKind.RelativeOrAbsolute), museoHistoria); * }*/ }