private void ApplicationBarIconButton_Click(object sender, EventArgs e) { DataClass NewlyCreated = new DataClass(); NewlyCreated.key = RealWord.Text.Trim().ToLower(); NewlyCreated.value = ConvertWord.Text; NewlyCreated.use = toUse.IsChecked.Value; //Check to see if that word already exists foreach (DataClass ToCheck in a.Words) { if(ToCheck.key.Equals(NewlyCreated.key)) { MessageBox.Show("The word " + NewlyCreated.key + " already exists. Please edit that word from the 'Word List' page instead."); return; } } a.Words.Add(NewlyCreated); if (NewlyCreated.use) // add new entry if selection is true WordsToWorkListMgmt.AddToWorkList(NewlyCreated.key, a.Words, a.WorkList); NavigationService.GoBack(); }
//Bind the currently passed object to the page. void LoadPageElements(string wordSelected) { currentSelected = a.Words.First(E => E.key.Equals(wordSelected)); this.DataContext = currentSelected; }