ArcGISPortalViewer.App.ShowExceptionDialog C# (CSharp) Method

ShowExceptionDialog() public static method

public static ShowExceptionDialog ( Exception ex, string messageTitle = "Exception", [ memberName = "" ) : System.Threading.Tasks.Task
ex System.Exception
messageTitle string
memberName [
return System.Threading.Tasks.Task
        public static async System.Threading.Tasks.Task ShowExceptionDialog(Exception ex, string messageTitle = "Exception", [System.Runtime.CompilerServices.CallerMemberName]string memberName = "")
        {
            #if DEBUG
                messageTitle = string.Format("{0} in: {1}.", messageTitle, memberName);
            #endif

            // make sure to call MessageDialog.ShowAsync on the ui thread.
            // force this by rescheduling the call using dispatcher.RunAync.
            var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
            if (dispatcher == null) return;
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var dialog = new Windows.UI.Popups.MessageDialog(ex.Message, messageTitle);
                if (dialog.Commands == null) return;
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancel", a => { }));
                var _ = dialog.ShowAsync();
            });
        }