Exemplo n.º 1
0
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("WordsView.OnNavigatedTo...");
     base.OnNavigatedTo(e);
     hasLoaded = false;
     if (editedWordItem != null)
     {
         editedWordItem = null;
         if (wordsModel != null)
             wordsModel.Filter(txtSearch.Text);
         hasLoaded = true;
     }
     else
     {
         WordStorage.Vocabulary useVocabulary = null;
         if (NavigationContext.QueryString.ContainsKey("vocabulary"))
         {
             int id = 0;
             if ( int.TryParse(NavigationContext.QueryString["vocabulary"], out id) )
                 useVocabulary = App.WordStorage.FindVocabulary(id);
         }
         wordsModel = useVocabulary == null ? new Model.WordsViewModel(App.TextToSpeech) : new Model.WordsViewModel(App.TextToSpeech, useVocabulary);
     }
     performanceProgressBar.Visibility = Visibility.Visible;
     performanceProgressBar.IsIndeterminate = true;
 }
Exemplo n.º 2
0
        private void Edit_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            ListBoxItem selectedListBoxItem = this.allList.ItemContainerGenerator.ContainerFromItem((sender as MenuItem).DataContext) as ListBoxItem;
            if (selectedListBoxItem == null)
            {
                return;
            }

            Model.WordListItemModel wordItem = selectedListBoxItem.DataContext as Model.WordListItemModel;

            if (wordItem != null)
            {
                var url = string.Format("/Views/WordEditor.xaml?mode=edit&id={0}", wordItem.Word.WordID);
                NavigationService.Navigate(new Uri(url, UriKind.Relative));

                editedWordItem = wordItem;
            }
        }