private void Adapter_EditClicked(int position) { var view = recycler.GetChildAt(position); var vieNote = view.FindViewById <TextView>(Resource.Id.viewNote); var editNote = view.FindViewById <TextView>(Resource.Id.noteEdit); var content = view.FindViewById <TextView>(Resource.Id.notesContent); var dialog = new AddNoteDialog(notes[position]); dialog.OnNoteSave += (Note note) => { notes[position] = note; var foundIdea = Global.Categories.FirstOrDefault(x => x.CategoryLbl == note.Category).Items.FirstOrDefault(y => y.Title == note.Title); if (foundIdea != null) { foundIdea.Note = note; } var foundBookmark = bookmarkedItems.FirstOrDefault(x => x.Title == notes[position].Title); if (foundBookmark != null) { foundBookmark.Note = note; } adapter.NotifyItemChanged(position); }; dialog.OnError += () => Snackbar.Make(recycler, "Invalid note. Please retry editing.", Snackbar.LengthLong).Show(); dialog.Show(FragmentManager, "NOTESFRAG"); }
private void Adapter_EditClicked(int position) { var dialog = new AddNoteDialog(notes[position]); dialog.OnNoteSave += (Note note) => { notes[position] = note; var foundIdea = Global.Categories.FirstOrDefault(x => x.CategoryLbl == note.Category).Items.FirstOrDefault(y => y.Title == note.Title); if (foundIdea != null) { foundIdea.Note = note; } var foundBookmark = bookmarkedItems.FirstOrDefault(x => x.Title == notes[position].Title); if (foundBookmark != null) { foundBookmark.Note = note; } adapter.NotifyItemChanged(position); SaveChanges(); }; dialog.OnError += () => Snackbar.Make(recycler, "Invalid note. Entry fields cannot be empty.", Snackbar.LengthLong).Show(); dialog.Show(FragmentManager, "NOTESFRAG"); }