using Avalonia.Controls; using Syncfusion.Pdf; using Syncfusion.Pdf.Graphics; namespace InABox.Avalonia { public class MobileDocument { public string FileName { get; set; } public byte[] Data { get; set; } public MobileDocument() { FileName = ""; Data = new byte[] { }; } public MobileDocument(string filename, byte[] data) { FileName = filename; Data = data; } public static async Task From(TopLevel window, TSource source) where TSource : MobileDocumentSource where TOptions : MobileDocumentOptions { var result = await source.From(window); return result; } public static async Task From(TopLevel? window, MobileDocumentOptions options) where T : MobileDocumentSource { if (window == null) throw new Exception("Window is null"); var source = (T)Activator.CreateInstance(typeof(T), new object[] { options }); var result = await source.From(window); return result; } } }