|
|
|
@ -125,6 +125,16 @@ namespace Avalonia |
|
|
|
{ |
|
|
|
return (T?) resolver.GetService(typeof (T)); |
|
|
|
} |
|
|
|
|
|
|
|
public static object GetRequiredService(this IAvaloniaDependencyResolver resolver, Type t) |
|
|
|
{ |
|
|
|
return resolver.GetService(t) ?? throw new InvalidOperationException($"Unable to locate '{t}'."); |
|
|
|
} |
|
|
|
|
|
|
|
public static T GetRequiredService<T>(this IAvaloniaDependencyResolver resolver) |
|
|
|
{ |
|
|
|
return (T?)resolver.GetService(typeof(T)) ?? throw new InvalidOperationException($"Unable to locate '{typeof(T)}'."); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|