mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-29 15:16:25 +02:00
misc: chore: Move converters into a directory in Helpers. Namespace unchanged
This commit is contained in:
parent
d75ce52bd4
commit
cc95e80ee9
11 changed files with 0 additions and 0 deletions
32
src/Ryujinx/UI/Helpers/Converters/GlyphValueConverter.cs
Normal file
32
src/Ryujinx/UI/Helpers/Converters/GlyphValueConverter.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using Avalonia.Markup.Xaml;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
public class GlyphValueConverter : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
|
||||
private static readonly Dictionary<Glyph, string> _glyphs = new()
|
||||
{
|
||||
{ Glyph.List, char.ConvertFromUtf32((int)Symbol.List) },
|
||||
{ Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) },
|
||||
{ Glyph.Chip, char.ConvertFromUtf32(59748) },
|
||||
{ Glyph.Important, char.ConvertFromUtf32((int)Symbol.Important) },
|
||||
};
|
||||
|
||||
public GlyphValueConverter(string key)
|
||||
{
|
||||
_key = key;
|
||||
}
|
||||
|
||||
public string this[string key] =>
|
||||
_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out var val)
|
||||
? val
|
||||
: string.Empty;
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => this[_key];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue