public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) // Notes.asi { if (container == null) { return(null); } var view = inflater.Inflate(Resource.Layout.otheredit, null); var btn = view.FindViewById <Button>(Resource.Id.button1); var change = view.FindViewById <EditText>(Resource.Id.edittext); var editbtn = view.FindViewById <Button>(Resource.Id.editbtn); var add = new NoteThings(); var intent = new Intent(Activity, typeof(MainActivity)); editbtn.Click += delegate { note.edit(ViewId + 1, change.Text); StartActivity(intent); }; btn.Click += delegate { note.DeleteNote(note.GetAllNotes().ToList()[ViewId].Id); StartActivity(intent); }; var NoteList = note.GetAllNotes().ToList(); change.Text = NoteList.ElementAt(ViewId).Notetext; return(view); }
public void DeleteNote(int id) { NoteThings noteToDelete = new NoteThings(); noteToDelete.Id = id; Db.Delete(noteToDelete); }
public void Addnote(string notecaption, string notetext) { var newnote = new NoteThings { Noteheading = notecaption, Notetext = notetext }; Db.Insert(newnote); }
public void SampleData() { Db.CreateTable <NoteThings>(); if (Db.Table <NoteThings>().Count() == 0) { var samepls = new NoteThings(); samepls.Noteheading = "Hello"; samepls.Notetext = "This is a simple note taking app. You can add notes " + "by pressing on the ADD NOTES button. To edit the content of your note simply press" + "on your note and overwrite the text and then press the EDIT button." + "To Delete the Note just press on the note that you want to delete and press on the DELETE button (you cannot delete this note)"; Db.Insert(samepls); } }
void Button_Click(object sender, EventArgs e) { NoteThings fck = new NoteThings(); var f**k = FindViewById <EditText>(Resource.Id.textInputEditText1); var palun = FindViewById <EditText>(Resource.Id.textInputEditText2); fck.Noteheading = f**k.Text; fck.Notetext = palun.Text; note.Addnote(fck.Noteheading, fck.Notetext); StartActivity(typeof(MainActivity)); }