// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Media;
using Windows.Foundation;
namespace CommunityToolkit.WinUI.UI.Controls
{
///
/// Arguments for the event which is called when a url needs to be resolved to a .
///
public class ImageResolvingEventArgs : EventArgs
{
private readonly IList> _deferrals;
internal ImageResolvingEventArgs(string url, string tooltip)
{
_deferrals = new List>();
Url = url;
Tooltip = tooltip;
}
///
/// Gets the url of the image in the markdown document.
///
public string Url { get; }
///
/// Gets the tooltip of the image in the markdown document.
///
public string Tooltip { get; }
///
/// Gets or sets a value indicating whether this event was handled successfully.
///
public bool Handled { get; set; }
///
/// Gets or sets the image to display in the .
///
public ImageSource Image { get; set; }
///
/// Informs the that the event handler might run asynchronously.
///
/// Deferral
public Deferral GetDeferral()
{
var task = new TaskCompletionSource