예제 #1
0
        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);
            }
        }
예제 #2
0
        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;
                }
            });
        }
예제 #3
0
        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;
                }
            });
        }
예제 #4
0
		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;
				}
            });
        }