Пример #1
0
        public void SetComment(Comment target)
        {
            Target = target;
            commentContent.Buffer.Text = target.text;
            FontDescription monospace = FontDescription.FromString("monospace 8");

            commentContent.ModifyFont(monospace);
            monospace.Dispose();

            nameLabel.Text = target.author;
        }
Пример #2
0
        public bool PostComment(int bugId, string text)
        {
            Console.WriteLine ("Posting comment");
            // Set the source if it hasn't been set alreayd
            Generator.SetSource (SplatterCore.Instance.Sources[this.SourceID]);

            Tracer trace = new Tracer();
            trace.Attach(Generator.bugProxy);
            PostCommentParams postCommentParams = new PostCommentParams();
            postCommentParams.id = bugId;
            postCommentParams.comment = text;

            // Make the request;
            XmlRpcStruct result;
            try{
            result = Generator.bugProxy.PostComment(postCommentParams);
            }
            catch{
                return false;
            }

            // This is probably stupid. Let's reconstruct the entire comment :);
            Comment target = new Comment();
            target.bug_id = bugId;
            target.id = (int)result["id"];
            target.text = text;

            // Retrieve the author
            this.Source = SplatterCore.Instance.Sources[SourceID];
            target.author = Source.UserName;

            target.time = DateTime.Now;
            //target.is_private = false;

            // Add the comment to the bug
            BugReport bug = BugFromBugId(bugId);

            bug.Comments.Add(target);

            return true;
        }