0

I have problems with showing a MessageDialog. I am using Windows IoT core (should be the newest version) running on a Raspberry Pi 3.

In the Debug version everything works fine and the MessageDialog shows up. When I deploy the Release Version the MessageDialog does not show up and the program runs although it should wait for an user interaction.

Are there any settings which have to be done?

var messageDialog = new Windows.UI.Popups.MessageDialog(Message, Title); 
await messageDialog.ShowAsync(); 

On some messages I have added a MessageDialog command like:

messageDialog.Commands.Add(new UICommand("commandtext", new UICommandInvokedHandler(this.CommandInvokedHandler)));
Jimenemex
  • 3,104
  • 3
  • 24
  • 56

1 Answers1

0

There are some threads about Windows.UI.Popups.MessageDialog not supported on Windows iot core: [1] [2]. But they old and new version 16299 that I test with release deploy, it works. My os version on Raspberry Pi 3 is 10.0.16299.309.

So check your target and min version and try again to see if it works.

I test the following two conditions and both of them work:

enter image description here enter image description here

This is the code I use:

MainPage.xaml

<StackPanel VerticalAlignment="Center" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Button Content="OpenDialog" Click="Button_Click" />
    <TextBlock Name="CommandInvoked" Text="Waiting..."/>
</StackPanel>

MainPage.xaml.cs

    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        string Message = "test.";
        string Title = "Testing message dialog.";
        var messageDialog = new Windows.UI.Popups.MessageDialog(Message, Title);
        messageDialog.Commands.Add(new UICommand("commandtext", new UICommandInvokedHandler(this.CommandInvokedHandler)));
        await messageDialog.ShowAsync();
    }

    private void CommandInvokedHandler(IUICommand command)
    {
        CommandInvoked.Text = "CommandInvokedHandler invoked.";
    }
Rita Han
  • 9,574
  • 1
  • 11
  • 24