private WindowIcon CreateIconFromPath(ITypeDescriptorContext context, string s) { var uri = s.StartsWith("/") ? new Uri(s, UriKind.Relative) : new Uri(s, UriKind.RelativeOrAbsolute); if (uri.IsAbsoluteUri && uri.IsFile) { return(new WindowIcon(uri.LocalPath)); } var assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); return(new WindowIcon(assets.Open(uri, context.GetBaseUri()))); }
private WindowIcon CreateIconFromPath(ITypeDescriptorContext context, string path) { var uri = new Uri(path, UriKind.RelativeOrAbsolute); var scheme = uri.IsAbsoluteUri ? uri.Scheme : "file"; switch (scheme) { case "file": return(new WindowIcon(path)); default: var assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); return(new WindowIcon(assets.Open(uri, context.GetBaseUri()))); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var uri = new Uri((string)value, UriKind.RelativeOrAbsolute); var scheme = uri.IsAbsoluteUri ? uri.Scheme : "file"; switch (scheme) { case "file": return(new Bitmap((string)value)); default: var assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); return(new Bitmap(assets.Open(uri, context.GetBaseUri()))); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = (string)value; var uri = s.StartsWith("/") ? new Uri(s, UriKind.Relative) : new Uri(s, UriKind.RelativeOrAbsolute); if (uri.IsAbsoluteUri && uri.IsFile) { return(new Bitmap(uri.LocalPath)); } var assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); return(new Bitmap(assets.Open(uri, context.GetBaseUri()))); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = (string)value; return(FontFamily.Parse(s, context.GetBaseUri())); }