Example #1
0
        void InitQueue()
        {
            queue = new QueueListener();
            queue.MessageReceived += (message) => {
                Task.Run(() => {
                    var question = JObject.Parse(message);
                    if (question["question"] == null)
                    {
                        return;
                    }
                    questions[question["question"].ToString()] = new Question()
                    {
                        ID         = question["_id"].ToString(),
                        issueID    = question["issueId"].ToString(),
                        Text       = question["question"].ToString(),
                        State      = question["state"].ToString(),
                        Department = question["department"].ToString(),
                        Date       = question["createdAt"].ToString()
                    };
                    var row = new ListBoxRow();
                    row.Add(new Label {
                        Text = question["question"].ToString(), Expand = true
                    });
                    questionsList.Add(row);
                    row.ShowAll();
                });
            };

            queue.Init();
        }
Example #2
0
        public void InsertQuestion(JToken question)
        {
            try {
                questions[question["question"].ToString()] = new Question()
                {
                    Text       = question["question"].ToString(),
                    State      = question["state"].ToString(),
                    Department = question["department"].ToString(),
                    Date       = question["createdAt"].ToString()
                };

                if (question["answer"] != null)
                {
                    questions[question["question"].ToString()].Answer = question["answer"].ToString();
                }

                var row = new ListBoxRow();
                row.Add(new Label {
                    Text = question["question"].ToString(), Expand = true
                });

                questionsList.Add(row);
                row.ShowAll();
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
Example #3
0
        private void InsertUnassignedIssue(JToken issue)
        {
            issues[issue["title"].ToString()] = new Issue()
            {
                Title       = issue["title"].ToString(),
                ID          = issue["_id"].ToString(),
                Description = issue["description"].ToString(),
                State       = issue["state"].ToString(),
                Date        = issue["createdAt"].ToString(),
                Creator     = issue["creator"].ToString()
            };

            var listBoxRow = new ListBoxRow();

            listBoxRow.Add(new Label {
                Text = issue["title"].ToString(), Expand = true
            });

            unassignedIssues.Add(listBoxRow);
            listBoxRow.ShowAll();
        }
Example #4
0
        private async Task SendQuestion()
        {
            try {
                Console.WriteLine("coiso");
                var endpoint    = $"http://localhost:3000/api/solver/{issueID}/question";
                var requestBody = new JObject();
                requestBody["question"]   = questionText.Buffer.Text;
                requestBody["department"] = departmentEntry.Text;

                var response = await SolverApp.PostRequest(endpoint, requestBody);

                if (response["question"] == null)
                {
                    return;
                }

                var responseQuestion = response["question"];

                issueWindow.questions[responseQuestion["question"].ToString()] = new Question()
                {
                    Text       = responseQuestion["question"].ToString(),
                    Department = responseQuestion["department"].ToString(),
                    State      = responseQuestion["state"].ToString(),
                    Date       = responseQuestion["createdAt"].ToString()
                };

                var questionRow = new ListBoxRow();
                questionRow.Add(new Label {
                    Text = responseQuestion["question"].ToString(), Expand = true
                });
                issueWindow.questionsList.Add(questionRow);
                questionRow.ShowAll();

                issueWindow.Sensitive = true;
                SolverApp.GetApp().RemoveWindow(this);
                this.Dispose();
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
        }