private static UIElement LoadXamlResource(IIconResource resource) { using (var stream = Application.GetResourceStream(resource.Uri)?.Stream) { return(XamlReader.Load(stream) as UIElement); } }
private static UIElement LoadBitmapResource(IIconResource resource) { return(new Image { Source = new BitmapImage(resource.Uri) }); }
public static UIElement Load(IIconResource resource) { try { if (resource.IsBitmapResource) { return(LoadBitmapResource(resource)); } else if (resource.IsXamlResource) { return(LoadXamlResource(resource)); } } catch (Exception) { return(NotFoundSymbol()); } throw new NotSupportedException($"Application icon resource of type '{resource.GetType()}' is not supported!"); }
public LogNotificationInfo(IText text) { Tooltip = text.Get(TextKey.Notification_LogTooltip); IconResource = new LogNotificationIconResource(); }
private void Instance_IconChanged(IIconResource icon) { Dispatcher.InvokeAsync(() => Icon.Content = IconResourceLoader.Load(icon)); }