示例#1
0
 private static UIElement LoadXamlResource(IIconResource resource)
 {
     using (var stream = Application.GetResourceStream(resource.Uri)?.Stream)
     {
         return(XamlReader.Load(stream) as UIElement);
     }
 }
示例#2
0
 private static UIElement LoadBitmapResource(IIconResource resource)
 {
     return(new Image
     {
         Source = new BitmapImage(resource.Uri)
     });
 }
示例#3
0
        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!");
        }
示例#4
0
 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));
 }