public async Task UpdateNote() { try { CurrNote.Content = _textview.Text; await NoteDatabase.UpdateNoteLocal(CurrNote); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async void SaveTimer() { while (_isRunning) { Thread.Sleep(5000); InvokeOnMainThread(() => { CurrNote.Content = _textview.Text; }); //Don't update on the UI thread, in case it takes longer await NoteDatabase.UpdateNoteLocal(CurrNote); } }
public async Task SaveNote() { await Task.Run(() => { InvokeOnMainThread(async() => { if (CurrNote == null && _textview.Text != null) { if (!_textview.Text.Equals("")) { string sTitle = _title.Text; string sContent = _textview.Text; CurrNote = await NoteDatabase.InsertNoteToLocal(sTitle, sContent, 1); } } else if (CurrNote != null) { CurrNote.Title = _title.Text; CurrNote.Content = _textview.Text; await NoteDatabase.UpdateNoteLocal(CurrNote); } }); }); }