/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/ShortcutGuide/ShortcutGuide.Ui/Helpers/StringResourceExtension.cs
30 строк
1 KB
Noraa Junker
Shortcut Guide V2 (#40834)
21 май 2026, 18:27
Не верифицирован
21 май 2026, 18:27
9699d8a
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.UI.Xaml.Markup; namespace ShortcutGuide.Helpers { [MarkupExtensionReturnType(ReturnType = typeof(string))] public partial class StringResourceExtension : MarkupExtension { public enum SpecialTreatment { None, FirstCharOnly, EverythingExceptFirstChar, } public string Key { get; set; } = string.Empty; public SpecialTreatment Treatment { get; set; } = SpecialTreatment.None; protected override object ProvideValue() => this.Treatment switch { SpecialTreatment.FirstCharOnly => ResourceLoaderInstance.ResourceLoader.GetString(this.Key)[0].ToString(), SpecialTreatment.EverythingExceptFirstChar => ResourceLoaderInstance.ResourceLoader.GetString(this.Key)[1..], _ => ResourceLoaderInstance.ResourceLoader.GetString(this.Key), }; } }