private async void RemoveEntry(ViewModel_DiaryEntry entry) { //Removes an entry bool answer = await App.Current.MainPage.DisplayAlert("Removing a Diary Entry", "Are you sure you want to delete this Diary Entry?", "Yes", "No"); if (answer == true) { Console.WriteLine("Removing Entry "); DiaryEntries.Remove(entry); List <ViewModel_DiaryPage> entries = new List <ViewModel_DiaryPage>(DiaryEntries); UserDiaryFileController.Save(entries); } }
public void SaveCover(ViewModel_DiaryCover cover) { //Saves the Cover of the Diary ViewModel_DiaryCover updatedEntry = new ViewModel_DiaryCover(cover.Cover) { CurrentState = ViewModel_DiaryPage.PageState.COMPLETED }; DiaryEntries[0] = updatedEntry; List <ViewModel_DiaryPage> entries = new List <ViewModel_DiaryPage>(DiaryEntries); //Adds current diary list from viewmodel UserDiaryFileController.Save(entries); }
private void EditCover(ViewModel_DiaryCover cover) { //Edits the Cover of the diary, which is also typically the first page of the diary ViewModel_DiaryCover updatedEntry = new ViewModel_DiaryCover(cover.Cover) { CurrentState = ViewModel_DiaryPage.PageState.EDITING }; DiaryEntries[0] = updatedEntry; List <ViewModel_DiaryPage> entries = new List <ViewModel_DiaryPage>(DiaryEntries); //Adds current diary list from viewmodel UserDiaryFileController.Save(entries); }
//Saves the Diary Entry public void SaveEntry(ViewModel_DiaryEntry entry) { //Saves an entry Console.WriteLine("Saving Entry " + entry.CurrentState); entry.Entry.LastEdited = DateTime.Now; AppPreferences.LastDiaryEntry = entry.Entry.LastEdited; ViewModel_DiaryEntry updatedEntry = new ViewModel_DiaryEntry() { Entry = entry.Entry }; updatedEntry.CurrentState = ViewModel_DiaryPage.PageState.COMPLETED; int i = DiaryEntries.IndexOf(entry); DiaryEntries[i] = updatedEntry; List <ViewModel_DiaryPage> entries = new List <ViewModel_DiaryPage>(DiaryEntries); //Adds current diary list from viewmodel UserDiaryFileController.Save(entries); }