private void SmallList_Tap(object sender, System.Windows.Input.GestureEventArgs e) { LongListSelector selectedItem = sender as LongListSelector; if (selectedItem == null) { return; } DictionaryContents d = selectedItem.SelectedItem as DictionaryContents; NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + d.BigDefinition + "&selectedWord=" + d.Word, UriKind.Relative)); }
async void delete_Click(object sender, EventArgs e) { /* IList source = LongList.ItemsSource as IList; * while (LongList.SelectedItems.Count > 0) * { * source.Remove((DictionaryContents)LongList.SelectedItems[0]); * } * LongListMultiSelector l = sender as LongListMultiSelector; */ /* * IList source = LongList.ItemsSource as IList; * * * * while (LongList.SelectedItems.Count > 0) * { * source.Remove((DictionaryContents)LongList.SelectedItems[0]); * } */ DictionaryContents[] selectedItems = new DictionaryContents[LongList.SelectedItems.Count]; for (int i = 0; i < LongList.SelectedItems.Count; i++) { selectedItems[i] = (DictionaryContents)LongList.SelectedItems[i]; } // LongList.IsSelectionEnabled = false; for (int i = 0; i < selectedItems.Length; i++) { App.ViewModel.Items.Remove(selectedItems[i]); } var serializer = new DataContractJsonSerializer(typeof(SavedData)); using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync( DictionaryContents.fileName, CreationCollisionOption.ReplaceExisting)) { serializer.WriteObject(stream, App.ViewModel); } // select.IsEnabled = true; }
private void Search_ActionIconTapped(object sender, EventArgs e) { if (!IsInternet()) { MessageBox.Show("An Internet Connection is needed to use the dictionary..."); return; } dictionaryContents = new DictionaryContents(); if (SearchText.Text == "") { content.Text = "Please enter a word!"; return; } bar.Focus(); content.Text = ""; // webv.Navigate(new Uri("http://www.yourdictionary.com/" + SearchText.Text)); appBarButton.IsEnabled = false; AccessTheWebAsync(); }