コード例 #1
0
        private void ShowCommentComposer(int line)
        {
            var composer = new Composer();

            composer.NewComment(this, (text) => {
                composer.DoWork(() => {
                    var c = Application.Client.Execute(Application.Client.Users[_user].Repositories[_slug].Commits[_branch].Comments.Create(text, _commit.Filename, line)).Data;

                    //This will inheriently add it to the controller's comments which we're referencing
                    if (Comments != null)
                    {
                        Comments.Add(c);
                    }

                    var a = new List <CommentModel>();
                    a.Add(c);
                    AddComments(a);

                    InvokeOnMainThread(() => composer.CloseComposer());
                }, ex => {
                    MonoTouch.Utilities.ShowAlert("Unable to Comment".t(), ex.Message);
                    composer.EnableSendButton = true;
                });
            });
        }
コード例 #2
0
        private void HandleEditButton()
        {
            try
            {
                var page = CurrentWikiPage(Web.Request);
                var wiki = Application.Client.Users[_user].Repositories[_slug].Wikis[page].GetInfo();

                var composer = new Composer { Title = "Edit " + Title, Text = wiki.Data, ActionButtonText = "Save" };
                composer.NewComment(this, () => {
                    var text = composer.Text;

                    composer.DoWork(() => {
                        Application.Client.Users[_user].Repositories[_slug].Wikis[page].Update(text, Uri.UnescapeDataString("/" + page));

                        InvokeOnMainThread(() => {
                            composer.CloseComposer();
                            Refresh();
                        });
                    }, ex =>
                    {
                        Utilities.ShowAlert("Unable to update page!", ex.Message);
                        composer.EnableSendButton = true;
                    });
                });
            }
            catch (Exception e)
            {
                Utilities.ShowAlert("Error", e.Message);
            }
        }
コード例 #3
0
        void AddCommentTapped()
        {
            var composer = new Composer();
            composer.NewComment(this, () =>
            {
                var comment = new CommentModel { Content = composer.Text };

                composer.DoWork(() =>
                {
                    Application.Client.Users[User].Repositories[Slug].Issues[Id].Comments.Create(comment);

                    InvokeOnMainThread(() =>
                    {
                        composer.CloseComposer();
                        _scrollToLastComment = true;
                        Model = null;
                        UpdateAndRender();
                    });
                }, ex =>
                {
                    Utilities.ShowAlert("Unable to post comment!", ex.Message);
                    composer.EnableSendButton = true;
                });
            });
        }