private void ResetDiary() { //Deletes the diary. Opening the diary part of the app still creates a new diary file anyway. UserDiaryFileController.DeleteDiary(); Console.WriteLine("Diary Deleted"); RefreshInfo(); }
private void RefreshViewModel() { ObservableRangeCollection <ViewModel_DiaryPage> entries = new ObservableRangeCollection <ViewModel_DiaryPage>(); entries.AddRange(UserDiaryFileController.Load()); DiaryEntries = entries; }
private async void ResetDiary() { //Deletes the diary. Opening the diary part of the app still creates a new diary file anyway. bool answer = await Application.Current.MainPage.DisplayAlert("Reset Journal", "Are you sure you want to reset the Journal?", "Yes", "No"); if (answer) { UserDiaryFileController.DeleteDiary(); Console.WriteLine("Diary Deleted"); RefreshInfo(); } }
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); }