using MangaReader.Core.Search; using MangaReader.Core.Sources.MangaDex.Api; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; using Windows.Foundation; using Windows.Foundation.Collections; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. namespace MangaReader.WinUI { /// /// An empty window that can be used on its own or navigated to within a Frame. /// public sealed partial class MainWindow : Window { private readonly IMangaSearchCoordinator _mangaSearchCoordinator; private readonly IMangaDexClient _mangaDexClient; private CancellationTokenSource? _cancellationTokenSource; public MainWindow(IMangaSearchCoordinator mangaSearchCoordinator, IMangaDexClient mangaDexClient) { InitializeComponent(); _mangaSearchCoordinator = mangaSearchCoordinator; _mangaDexClient = mangaDexClient; } //private async void Button_Click(object sender, RoutedEventArgs e) //{ // if (string.IsNullOrWhiteSpace(KeywordTextBox.Text)) // return; // _cancellationTokenSource?.Cancel(); // _cancellationTokenSource = new(); // var result = await _mangaSearchCoordinator.SearchAsync(KeywordTextBox.Text, _cancellationTokenSource.Token); // //Guid mangaGuid = new("a920060c-7e39-4ac1-980c-f0e605a40ae4"); // //var coverArtResult = await _mangaDexClient.GetCoverArtAsync(mangaGuid, _cancellationTokenSource.Token); // // if ( (coverArtResult is MangaDexC) // // { // // } // // if (coverArtResult.) //} } }