private void ListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { if (TechnicListBox.SelectedIndex == -1) { return; } TechniqueViewModel item = new TechniqueViewModel(); item = TechnicListBox.SelectedItem as TechniqueViewModel; NavigationService.Navigate(new Uri("/Technique.xaml?TechniqueId=" + item.Id, UriKind.Relative)); TechnicListBox.SelectedIndex = -1; }
private void BtAdd_Click(object sender, RoutedEventArgs e) { try { String technicName = tbTechnicName.Text.ToString(); TechniqueViewModel result = Items.Where(X => X.Name == technicName).FirstOrDefault(); WebBrowserTask webBrowserTask = new WebBrowserTask(); //webBrowserTask.Uri = new Uri(result.VideoLink.ToString(), UriKind.Absolute); webBrowserTask.URL = "vnd.youtube:" + result.VideoLink.ToString().Substring(result.VideoLink.ToString().LastIndexOf("=") + 1); webBrowserTask.Show(); } catch { MessageBox.Show("You better uninstall the YouTube app and install it again.", "Oops!", MessageBoxButton.OK); } }