diff --git a/Totoro.WinUI/Helpers/Converters.cs b/Totoro.WinUI/Helpers/Converters.cs index a2bc2f6..0534108 100644 --- a/Totoro.WinUI/Helpers/Converters.cs +++ b/Totoro.WinUI/Helpers/Converters.cs @@ -247,6 +247,17 @@ public static ImageSource StreamToImage(Stream stream) return bmp; } + public static ImageSource StringToImage(string uri) + { + if(string.IsNullOrEmpty(uri)) + { + return null; + } + + return new BitmapImage(new Uri(uri)); + } + + public static string ToOneBasedIndex(int number) => (number + 1).ToString(); public static string ToTitle(ChapterModel chapter) => string.IsNullOrEmpty(chapter.Title) ? chapter.Chapter.ToString() diff --git a/Totoro.WinUI/MainWindow.xaml b/Totoro.WinUI/MainWindow.xaml index 69e0e03..f191f65 100644 --- a/Totoro.WinUI/MainWindow.xaml +++ b/Totoro.WinUI/MainWindow.xaml @@ -43,8 +43,8 @@ + DisplayName="{x:Bind Shell.ViewModel.User.Name, Mode=OneWay}" + ProfilePicture="{x:Bind help:Converters.StringToImage(Shell.ViewModel.User.Name)}"/>