private void Commit() { var composer = new LiteComposer { Title = "Commit Message" }; composer.Text = "Update " + ViewModel.Path.Substring(ViewModel.Path.LastIndexOf('/') + 1); var text = _textView.Text; composer.ReturnAction += (s, e) => CommitThis(ViewModel, composer, text, e); _textView.BecomeFirstResponder (); NavigationController.PushViewController(composer, true); }
/// <summary> /// Need another function because Xamarin generates an Invalid IL if used inline above /// </summary> private async Task CommitThis(EditSourceViewModel viewModel, LiteComposer composer, string content, string message) { try { await this.DoWorkAsync("Commiting...", () => viewModel.Commit(content, message)); NavigationController.DismissViewController(true, null); } catch (Exception ex) { AlertDialogService.ShowAlert("Error", ex.Message); composer.EnableSendButton = true; } }