Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1019 Bytes

GettingStartedUWP.md

File metadata and controls

34 lines (25 loc) · 1019 Bytes

Getting Started

⚠ This documentation is applicable for versions 1.0.X and below.

Here is how to setup the service in your UWP or mobile apps made with Uno Platform (Uno.UI).

  1. Install the MessageDialogService.Uno nuget package.

  2. Create a MessageDialogService instance.

    using Windows.ApplicationModel.Resources;
    
    // (...)
    
    var currentWindow = yourWindow; // Get the current window.;
    var coreDispatcher = currentWindow.CoreDispatcher;
    var resourceLoader = ResourceLoader.GetForViewIndependentUse();
    var resourceResolver = resourceKey => resourceLoader.GetString(resourceKey);
    
    var messageDialogService = new MessageDialogService.MessageDialogService(
       () => coreDispatcher,   
       new MessageDialogBuilderDelegate(resourceResolver)
    );
  3. Use the service to prompt a message dialog.

    await messageDialogService.ShowMessage(ct, mb => mb
       .Title("Oops!")
       .Content("Something went wrong.")
       .OkCommand()
    );