Ejemplo n.º 1
0
 private Models.WordModel GetWordModel(DictionaryExtension.WordModel premodel)
 {
     Models.WordModel result = new Models.WordModel();
     if (premodel.Pronounciations != null)
     {
         result.Pronounciations = premodel.Pronounciations.ToList();
     }
     if (premodel.InflectionWords != null)
     {
         foreach (var inflectionword in premodel.InflectionWords)
         {
             result.InflectionWords.Add(new Models.InflectionWord()
             {
                 InflectionType = inflectionword.InflectionType,
                 Words          = inflectionword.Words.ToList()
             });
         }
     }
     if (premodel.Definitions != null)
     {
         foreach (var definition in premodel.Definitions)
         {
             result.Definitions.Add(new Models.Definition()
             {
                 PartOfSpeech = definition.PartOfSpeech,
                 Meanings     = definition.Meanings.ToList()
             });
         }
     }
     if (premodel.SampleSentences != null)
     {
         result.SampleSentences = premodel.SampleSentences.ToList();
     }
     return(result);
 }
 /// <summary>
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// <para>
 /// Page specific logic should be placed in event handlers for the
 /// <see cref="NavigationHelper.LoadState"/>
 /// and <see cref="NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method
 /// in addition to page state preserved during an earlier session.
 /// </para>
 /// </summary>
 /// <param name="e">Provides data for navigation methods and event
 /// handlers that cannot cancel the navigation request.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     Models.WordModel word = (Models.WordModel)e.Parameter;
     pageTitle.Text       = InfoPage.infoTitle;
     InfoTitle.Text       = word.getWord();
     InfoDescription.Text = word.getDescription();
     this.navigationHelper.OnNavigatedTo(e);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Executed when the user taps/selects an info-word from the Info-App Template Page. The app navigates to the Details page of the word.
 /// </summary>
 /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
 /// <param name="e">SelectionChangedEventArgs e an instance of SelectionChangedEventArgs including, in many cases, an object which inherits from SelectionChangedEventArgs. Contains additional information about the event, and sometimes provides ability for code handling the event to alter the event somehow.</param>
 private void InfoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (selectionWordList)
     {
         return;
     }
     Models.WordModel word = new Models.WordModel(info.getInfoTitleList().ElementAt(InfoList.SelectedIndex),
                                                  info.getInfoDescriptionList().ElementAt(InfoList.SelectedIndex));
     Frame.Navigate(typeof(InfoDetailPage), word);
     selectionWordList = true; InfoList.SelectedIndex = -1; selectionWordList = false;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Executed when the user taps/selects an info-word from the Info-App Template Page. The app navigates to the Details page of the word.
 /// </summary>
 /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
 /// <param name="e">SelectionChangedEventArgs e an instance of SelectionChangedEventArgs including, in many cases, an object which inherits from SelectionChangedEventArgs. Contains additional information about the event, and sometimes provides ability for code handling the event to alter the event somehow.</param>
 private void InfoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (selectionWordList) return;
     Models.WordModel word = new Models.WordModel(info.getInfoTitleList().ElementAt(InfoList.SelectedIndex),
     info.getInfoDescriptionList().ElementAt(InfoList.SelectedIndex));
     Frame.Navigate(typeof(InfoDetailPage), word);
     selectionWordList = true; InfoList.SelectedIndex = -1; selectionWordList = false;
 }