Improvement to navigation regions

This commit is contained in:
TheXamlGuy
2024-05-09 22:37:36 +01:00
parent 711353c8e9
commit 54d2b5374d
31 changed files with 173 additions and 184 deletions
@@ -2,6 +2,24 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Toolkit.UI.Controls.Avalonia">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="PersonPictureForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeForegroundThemeBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeFillThemeBrush" ResourceKey="AccentFillColorDefaultBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeStrokeThemeBrush" ResourceKey="ControlFillColorTransparentBrush" />
<StaticResource x:Key="PersonPictureEllipseFillThemeBrush" ResourceKey="ControlAltFillColorQuarternaryBrush" />
<StaticResource x:Key="PersonPictureEllipseFillStrokeBrush" ResourceKey="CardStrokeColorDefaultBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<StaticResource x:Key="PersonPictureForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeForegroundThemeBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeFillThemeBrush" ResourceKey="AccentFillColorDefaultBrush" />
<StaticResource x:Key="PersonPictureEllipseBadgeStrokeThemeBrush" ResourceKey="ControlFillColorTransparentBrush" />
<StaticResource x:Key="PersonPictureEllipseFillThemeBrush" ResourceKey="ControlAltFillColorQuarternaryBrush" />
<StaticResource x:Key="PersonPictureEllipseFillStrokeBrush" ResourceKey="CardStrokeColorDefaultBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<x:Double x:Key="PersonPictureEllipseBadgeStrokeOpacity">1</x:Double>
<x:Double x:Key="PersonPictureEllipseBadgeImageSourceStrokeOpacity">1</x:Double>
<x:Double x:Key="PersonPictureEllipseStrokeThickness">1</x:Double>
@@ -2,39 +2,41 @@
internal class PersonPictureInitialsGenerator
{
public static PersonPictureCharacterType GetCharacterType(string str)
public static PersonPictureCharacterType GetCharacterType(string content)
{
PersonPictureCharacterType result = PersonPictureCharacterType.Other;
for (int i = 0; i < 3; i++)
if (content is { Length: > 0 })
{
if ((i >= str.Length) || (str[i] == '\0') || (str[i] == 0xFEFF))
for (int i = 0; i < 3; i++)
{
break;
}
if ((i >= content.Length) || (content[i] == '\0') || (content[i] == 0xFEFF))
{
break;
}
char character = str[i];
PersonPictureCharacterType evaluationResult = GetCharacterType(character);
char character = content[i];
PersonPictureCharacterType evaluationResult = GetCharacterType(character);
switch (evaluationResult)
{
case PersonPictureCharacterType.Glyph:
result = PersonPictureCharacterType.Glyph;
break;
case PersonPictureCharacterType.Symbolic:
if (result != PersonPictureCharacterType.Glyph)
{
result = PersonPictureCharacterType.Symbolic;
}
break;
case PersonPictureCharacterType.Standard:
if ((result != PersonPictureCharacterType.Glyph) && (result != PersonPictureCharacterType.Symbolic))
{
result = PersonPictureCharacterType.Standard;
}
break;
default:
break;
switch (evaluationResult)
{
case PersonPictureCharacterType.Glyph:
result = PersonPictureCharacterType.Glyph;
break;
case PersonPictureCharacterType.Symbolic:
if (result != PersonPictureCharacterType.Glyph)
{
result = PersonPictureCharacterType.Symbolic;
}
break;
case PersonPictureCharacterType.Standard:
if ((result != PersonPictureCharacterType.Glyph) && (result != PersonPictureCharacterType.Symbolic))
{
result = PersonPictureCharacterType.Standard;
}
break;
default:
break;
}
}
}
return result;
@@ -6,6 +6,7 @@
<MergeResourceInclude Source="../ContentDialog/ContentDialog.axaml" />
<MergeResourceInclude Source="../SettingsExpander/SettingsExpander.axaml" />
<MergeResourceInclude Source="../SettingsExpander/SettingsExpanderItem.axaml" />
<MergeResourceInclude Source="../PersonPicture/PersonPicture.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>