C# 为什么我的消息框出现两次?

C# 为什么我的消息框出现两次?,c#,xaml,push-notification,windows-10-universal,wns,C#,Xaml,Push Notification,Windows 10 Universal,Wns,我正在使用XAML和C#在Windows 10中制作一个警报应用程序。我正在使用WNS执行推送通知。我编写了一个函数,当我在应用程序中收到通知时会触发该函数。这是我的密码: private async void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs e) { e.Cancel = true; st

我正在使用XAML和C#在Windows 10中制作一个警报应用程序。我正在使用WNS执行推送通知。我编写了一个函数,当我在应用程序中收到通知时会触发该函数。这是我的密码:

 private async void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
    {
        e.Cancel = true;
        string jsonPayload = "{\"user_id\":\"" + CommonVariables.AuthenticateUserResponseDetails.user.id + "\"}";
        HttpClient client = new HttpClient();
        string postUrl = CommonVariables.SERVER + CommonVariables.Get_Alert;
        HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, postUrl);
        //encrypt tase

        EDecrypt encrypt = new EDecrypt();
        jsonPayload = encrypt.AES_Encrypt(jsonPayload, CommonVariables.EncryptionKey);

        request.Content = new StreamContent(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(jsonPayload)));
        var result = await client.SendAsync(request);
        string response = string.Empty;
        response = await result.Content.ReadAsStringAsync();
        EDecrypt edecrypt = new EDecrypt();
        response = edecrypt.AES_Decrypt(response, CommonVariables.EncryptionKey);
        response = response.Replace("\"", "");
        await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
        {
            messageBox(CommonVariables.AuthenticateUserResponseDetails.user.name +  " Please attend " + response + " Theatre");

        });

        ConfirmSeen();

    }
但是,当我收到通知时,消息框会出现两次。我已尝试将消息框代码置于Dispatcher之外,但应用程序出现错误。我做错了什么