private async Task HandleEditButton() { try { var page = ViewModel.CurrentWikiPage(Web.Url.AbsoluteString); var wiki = await Task.Run(() => ViewModel.GetApplication().Client.Users[ViewModel.Username].Repositories[ViewModel.Repository].Wikis[page].GetInfo()); var composer = new Composer { Title = "Edit" + Title, Text = wiki.Data }; composer.NewComment(this, async(text) => { try { await composer.DoWorkAsync("Saving...", () => Task.Run(() => ViewModel.GetApplication().Client.Users[ViewModel.Username].Repositories[ViewModel.Repository].Wikis[page].Update(text, Uri.UnescapeDataString("/" + page)))); composer.CloseComposer(); Refresh(); } catch (Exception ex) { AlertDialogService.ShowAlert("Unable to update page!", ex.Message); composer.EnableSendButton = true; }; }); } catch (Exception e) { AlertDialogService.ShowAlert("Error", e.Message); } }
private void ShowCommentComposer(int?lineFrom, int?lineTo) { var composer = new Composer(); composer.NewComment(this, async(text) => { try { await composer.DoWorkAsync("Commenting...", () => ViewModel.PostComment(text, lineFrom, lineTo)); composer.CloseComposer(); } catch (Exception e) { MonoTouch.Utilities.ShowAlert("Unable to Comment", e.Message); composer.EnableSendButton = true; } }); }
void AddCommentTapped() { var composer = new Composer(); composer.NewComment(this, async(text) => { try { await composer.DoWorkAsync("Commenting...", () => ViewModel.AddComment(text)); composer.CloseComposer(); } catch (Exception e) { MonoTouch.Utilities.ShowAlert("Unable to post comment!", e.Message); } finally { composer.EnableSendButton = true; } }); }
private void ShowCommentComposer(int? lineFrom, int? lineTo) { var composer = new Composer(); composer.NewComment(this, async (text) => { try { await composer.DoWorkAsync("Commenting...", () => ViewModel.PostComment(text, lineFrom, lineTo)); composer.CloseComposer(); } catch (Exception e) { MonoTouch.Utilities.ShowAlert("Unable to Comment".t(), e.Message); composer.EnableSendButton = true; } }); }