Azure функция для подтверждения пользователя во время Azure DevOps Pull Request - PullRequest
0 голосов
/ 13 января 2020

Этот вопрос относится к одному здесь

Я пытаюсь открыть диалоговое окно, чтобы показать автора в момент создания запроса на извлечение в моих Azure DevOps служба. Это окно должно отображаться в окне браузера автора следующим образом:

Запускали ли вы Системные тесты? Да Не применимо

Вот код, который у меня есть на данный момент, просто пытаюсь показать пустое окно сообщения

#r "Newtonsoft.Json"

using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
using System.Windows;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
    try
    {
        log.Info("Service Hook Received.");

        // Get request body
        dynamic data = await req.Content.ReadAsAsync<object>();

        log.Info("Data Received: " + data.ToString());

        // Get the pull request object from the service hooks payload
        dynamic jObject = JsonConvert.DeserializeObject(data.ToString());

        // Get the pull request id
        int pullRequestId;
        if (!Int32.TryParse(jObject.resource.pullRequestId.ToString(), out pullRequestId))
        {
            log.Info("Failed to parse the pull request id from the service hooks payload.");
        };

        // Get the pull request title
        string pullRequestTitle = jObject.resource.title;

        log.Info("Service Hook Received for PR: " + pullRequestId + " " + pullRequestTitle);

        // Get the pull request text
        string checkinNotes = jObject.detailedMessage.text;
        log.Info("Checkin notes Received for PR: " + pullRequestId + " " + checkinNotes);

        MessageBox.Show("Have you run System Tests?");

        return req.CreateResponse(HttpStatusCode.OK);
    }
    catch (Exception ex)
    {
        log.Info(ex.ToString());
        return req.CreateResponse(HttpStatusCode.InternalServerError);
    }
}

Когда я компилирую это, я получаю следующую ошибку:

2020-01-13T09:09:03.664 [Error] run.csx(41,9): error CS0103: The name 'MessageBox' does not exist in the current context

Как я могу изменить эту Azure функцию для достижения моей цели?

...