From ca1000d0c620a245ec14227a6a6cf1eb8b8449be Mon Sep 17 00:00:00 2001 From: DJYohann Date: Fri, 23 Jun 2023 00:20:28 +0200 Subject: [PATCH] :sparkles: Add few things --- App/Converters/Base64ToImage.cs | 6 ++-- App/MauiProgram.cs | 4 ++- App/Pages/ChampionAddEditPage.xaml | 9 ++++-- App/Pages/ChampionAddEditPage.xaml.cs | 1 + App/Pages/ChampionDetailPage.xaml | 12 +++---- App/Pages/ChampionDetailPage.xaml.cs | 28 ++++++++++------- App/Pages/ChampionsListPage.xaml | 35 ++++++++++++--------- App/Pages/ChampionsListPage.xaml.cs | 7 ++--- App/ViewModel/ChampionDetailPageVM.cs | 31 ++++++++++++++++++ App/ViewModel/ChampionListPageVM.cs | 45 ++++++++++++++++----------- ViewModel/ChampionManagerVM.cs | 2 ++ 11 files changed, 119 insertions(+), 61 deletions(-) create mode 100644 App/ViewModel/ChampionDetailPageVM.cs diff --git a/App/Converters/Base64ToImage.cs b/App/Converters/Base64ToImage.cs index ba220f9..f34fb4f 100644 --- a/App/Converters/Base64ToImage.cs +++ b/App/Converters/Base64ToImage.cs @@ -1,5 +1,4 @@ -using System; -using System.Globalization; +using System.Globalization; namespace App.Converters { @@ -13,8 +12,7 @@ namespace App.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var bytes = System.Convert.FromBase64String(value as string); - MemoryStream imageDecode = new MemoryStream(bytes); - return ImageSource.FromStream(() => imageDecode); + return ImageSource.FromStream(() => new MemoryStream(bytes)); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/App/MauiProgram.cs b/App/MauiProgram.cs index c19fcc0..aeff4dd 100644 --- a/App/MauiProgram.cs +++ b/App/MauiProgram.cs @@ -23,8 +23,10 @@ public static class MauiProgram }) .Services.AddSingleton() .AddSingleton() + .AddTransient() .AddSingleton() - .AddSingleton(); + .AddSingleton() + .AddSingleton(); #if DEBUG builder.Logging.AddDebug(); diff --git a/App/Pages/ChampionAddEditPage.xaml b/App/Pages/ChampionAddEditPage.xaml index 8692069..caf3fe4 100644 --- a/App/Pages/ChampionAddEditPage.xaml +++ b/App/Pages/ChampionAddEditPage.xaml @@ -5,6 +5,11 @@ xmlns:converters="clr-namespace:App.Converters" Title="Add Champion" BackgroundColor="Black"> + + + + + @@ -28,7 +33,7 @@ - +