Example #1
0
        private async void OnModalClosedNatively(object sender, ModalClosedEventArgs e)
        {
            try
            {
                if (_logger.IsEnabled(LogLevel.Debug))
                {
                    _logger.LogDebug($"Processing native close modal.");
                }

                // We schedule on a background thread because most of the work doesn't require any work on the UI thread.
                await Task.Run(async() => await CloseModal(CancellationToken.None, SectionsNavigatorRequest.GetCloseModalRequest(e.ModalName, transitionInfo: e.TransitionInfo)));
            }
            catch (Exception exception)
            {
                if (_logger.IsEnabled(LogLevel.Error))
                {
                    _logger.LogError($"Failed to process native close modal.", exception);
                }
            }
            finally
            {
                if (_logger.IsEnabled(LogLevel.Debug))
                {
                    _logger.LogDebug($"Processed native close modal.");
                }
            }
        }
Example #2
0
 /// <summary>
 /// Closes the top-most modal.
 /// </summary>
 /// <param name="sectionsNavigator">The sections navigator.</param>
 /// <param name="ct">The cancellation token.</param>
 public static async Task CloseModal(this ISectionsNavigator sectionsNavigator, CancellationToken ct)
 {
     await sectionsNavigator.CloseModal(ct, SectionsNavigatorRequest.GetCloseModalRequest(modalPriority: null));
 }