private void initDictionary() { var database = new TagDatabase (); //database.DeleteAllItems (); // For testing purposes var databaseItems = database.GetItems ().OrderBy (x => x.TagName); foreach (Tag item in databaseItems) { tagChecked.Add (item.TagName, false); } }
private async void addNewClicked(object sender, EventArgs e){ // Check to see if there is a tag if(newTagName != ""){ // Check if user error/accident var response = await DisplayAlert("Confirmation", "Do you wish to add " + newTagName + ". Warning, doing this will uncheck all tags selected so far.", "No, take me back", "Yes, add it"); // No = true and yes is false hence !response if (!response) { if (!tlist.tagChecked.ContainsKey (newTagName)) { // Add new tag to database var database = new TagDatabase (); Tag t = new Tag (newTagName); database.InsertOrUpdateTag (t); tlist.addToDictionary (t.TagName); // Reload list await Navigation.PopModalAsync (); createTagChoices (); } else { await DisplayAlert ("Error:", "The tag name is already in the list, please check the entry field and try again.", "Back"); } } }else { await DisplayAlert ("Error:", "The tag name was not specified, please check the entry field and try again.", "Back"); } }