misc: Abstract repeated logic in markup extensions & move Updater into the base of the Avalonia project.

This commit is contained in:
Evan Husted 2024-11-01 15:48:25 -05:00
parent 4c83794254
commit 1c07bf3dd0
10 changed files with 52 additions and 74 deletions

View file

@ -0,0 +1,39 @@
using Avalonia.Data.Core;
using Projektanker.Icons.Avalonia;
using Ryujinx.Ava.Common.Locale;
namespace Ryujinx.Ava.Common.Markup
{
internal class IconExtension(string iconString) : BasicMarkupExtension
{
protected override ClrPropertyInfo PropertyInfo
=> new(
"Item",
_ => new Icon { Value = iconString },
null,
typeof(Icon)
);
}
internal class SpinningIconExtension(string iconString) : BasicMarkupExtension
{
protected override ClrPropertyInfo PropertyInfo
=> new(
"Item",
_ => new Icon { Value = iconString, Animation = IconAnimation.Spin },
null,
typeof(Icon)
);
}
internal class LocaleExtension(LocaleKeys key) : BasicMarkupExtension
{
protected override ClrPropertyInfo PropertyInfo
=> new(
"Item",
_ => LocaleManager.Instance[key],
null,
typeof(string)
);
}
}