Codemaid
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
using Avalonia.Controls.Primitives;
|
||||
using FluentAvalonia.UI.Media.Animation;
|
||||
using FluentAvalonia.UI.Navigation;
|
||||
using System.Reflection;
|
||||
using Toolkit.Foundation;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ public class Cache<TKey, TValue>(IComparer<TKey> comparer) :
|
||||
notnull
|
||||
{
|
||||
private readonly List<KeyValuePair<TKey, TValue?>> items = [];
|
||||
|
||||
public TValue? this[TKey key]
|
||||
{
|
||||
get
|
||||
@@ -108,6 +109,7 @@ public class Cache<TKey, TValue>(IComparer<TKey> comparer) :
|
||||
|
||||
items.Insert(index, new KeyValuePair<TKey, TValue?>(key, value));
|
||||
}
|
||||
|
||||
public void Clear() => items.Clear();
|
||||
|
||||
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() =>
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Component :
|
||||
|
||||
return factory.Create<TComponent>(builder);
|
||||
}
|
||||
return default ;
|
||||
return default;
|
||||
}
|
||||
|
||||
public virtual IComponentBuilder Create() => builder;
|
||||
|
||||
@@ -10,7 +10,6 @@ public class ComponentHost(IServiceProvider services,
|
||||
{
|
||||
public IServiceProvider Services => services;
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IDecryptor
|
||||
{
|
||||
bool TryDecrypt(byte[] cipher,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Toolkit.Foundation;
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IHandlerProvider
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IKeyDeriver
|
||||
{
|
||||
byte[] DeriveKey(byte[] phrased,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IKeyGenerator
|
||||
{
|
||||
byte[] Generate(int size);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Toolkit.Foundation
|
||||
namespace Toolkit.Foundation
|
||||
{
|
||||
public interface IMediator
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IPasswordHasher
|
||||
{
|
||||
string HashPassword(string password, int iterations = 10000);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
@@ -57,6 +56,7 @@ public class NavigationScope(IPublisher publisher,
|
||||
case "self":
|
||||
region = view;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (navigationRegionProvider.TryGet(region, out object? value))
|
||||
{
|
||||
|
||||
@@ -365,9 +365,29 @@ public partial class ObservableCollection<TItem> :
|
||||
|
||||
TItem item = this[oldIndex];
|
||||
|
||||
bool selected = false;
|
||||
if (item is ISelectable selectable)
|
||||
{
|
||||
selected = selectable.Selected;
|
||||
|
||||
SelectedItem = default;
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
|
||||
RemoveItem(oldIndex);
|
||||
Insert(newIndex, item);
|
||||
|
||||
if (selected)
|
||||
{
|
||||
SelectedIndex = newIndex;
|
||||
SelectedItem = item;
|
||||
|
||||
if (item is ISelectable selectable2)
|
||||
{
|
||||
selectable2.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -493,14 +513,6 @@ public partial class ObservableCollection<TItem> :
|
||||
added.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnSelectedItemChanged(TItem? oldValue, TItem? newValue)
|
||||
{
|
||||
if (oldValue is ISelectable selectable)
|
||||
{
|
||||
selectable.Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ObservableCollection<TValue, TViewModel>(IServiceProvider provider,
|
||||
|
||||
@@ -49,7 +49,6 @@ public class Subscription(SubscriptionCollection subscriptions,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RemoveSubscriber(object subscriber,
|
||||
string key)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.3.24172.9" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.1-preview.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.4.24266.19" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -21,10 +21,9 @@ public class AttachedEventTriggerBehaviour : Trigger
|
||||
{
|
||||
if (AssociatedObject is Interactive interactive)
|
||||
{
|
||||
interactive.AddHandler(RoutedEvent, (object sender, RoutedEventArgs args) => {
|
||||
|
||||
interactive.AddHandler(RoutedEvent, (object sender, RoutedEventArgs args) =>
|
||||
{
|
||||
Interaction.ExecuteActions(AssociatedObject, Actions, null);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,4 @@ namespace Toolkit.UI.Avalonia;
|
||||
public class ItemInvokedEventArgs :
|
||||
RoutedEventArgs
|
||||
{
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class NavigateRegionAction :
|
||||
|
||||
[Content]
|
||||
public ActionCollection Actions => actions ??= [];
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => GetValue(NameProperty);
|
||||
|
||||
@@ -1,357 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Toolkit.UI.Controls.Avalonia"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20" />
|
||||
</Design.PreviewWith>
|
||||
<ControlTheme x:Key="{x:Type ui:ContentDialog}" TargetType="ui:ContentDialog">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ContentDialogBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ContentDialogBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource ContentDialogBorderWidth}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Name="Container">
|
||||
<Panel Name="LayoutRoot" Background="{DynamicResource ContentDialogSmokeFill}">
|
||||
<controls:BlurBehind />
|
||||
<ui:FABorder
|
||||
Name="BackgroundElement"
|
||||
MinWidth="{DynamicResource ContentDialogMinWidth}"
|
||||
MinHeight="{DynamicResource ContentDialogMinHeight}"
|
||||
MaxWidth="{DynamicResource ContentDialogMaxWidth}"
|
||||
MaxHeight="{DynamicResource ContentDialogMaxHeight}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{StaticResource ContentDialogBorderWidth}"
|
||||
BoxShadow="0 8 32 0 #66000000"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<!-- Even in WinUI, shadow is always black regardless of light/dark mode -->
|
||||
|
||||
<!--
|
||||
if this border isn't here, dialog space displays outside of corner radius at top
|
||||
if we put ClipToBounds=True on BackgroundElement above, it clips the shadow
|
||||
-->
|
||||
<Border ClipToBounds="True" CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid
|
||||
Name="DialogSpace"
|
||||
ClipToBounds="True"
|
||||
RowDefinitions="*,Auto">
|
||||
<ScrollViewer
|
||||
Name="ContentScrollViewer"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Border
|
||||
Padding="{DynamicResource ContentDialogPadding}"
|
||||
Background="{DynamicResource ContentDialogTopOverlay}"
|
||||
BorderBrush="{DynamicResource ContentDialogSeparatorBorderBrush}"
|
||||
BorderThickness="{StaticResource ContentDialogSeparatorThickness}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Grid.Styles>
|
||||
<!-- Make sure text wrapping is on -->
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
</Grid.Styles>
|
||||
<ContentControl
|
||||
Name="Title"
|
||||
Margin="{StaticResource ContentDialogTitleMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="{TemplateBinding Title}"
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||||
FontFamily="Default"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{TemplateBinding Foreground}">
|
||||
<ContentControl.Template>
|
||||
<ControlTemplate>
|
||||
<ContentPresenter
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</ControlTemplate>
|
||||
</ContentControl.Template>
|
||||
</ContentControl>
|
||||
|
||||
<ContentPresenter
|
||||
Name="Content"
|
||||
Grid.Row="1"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
FontFamily="{StaticResource ContentControlThemeFontFamily}"
|
||||
FontSize="{StaticResource ControlContentThemeFontSize}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Padding="{StaticResource ContentDialogPadding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="{TemplateBinding Background}">
|
||||
<Grid Name="CommandSpace">
|
||||
<!--
|
||||
B/C we can't target Row/Column defs in Styles like WinUI
|
||||
this still uses the old Col defs, but it works the same
|
||||
way in the end...
|
||||
-->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Name="PrimaryButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{TemplateBinding PrimaryButtonText}"
|
||||
IsEnabled="{TemplateBinding IsPrimaryButtonEnabled}"
|
||||
IsVisible="False" />
|
||||
|
||||
<Button
|
||||
Name="SecondaryButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{TemplateBinding SecondaryButtonText}"
|
||||
IsEnabled="{TemplateBinding IsSecondaryButtonEnabled}"
|
||||
IsVisible="False" />
|
||||
|
||||
<Button
|
||||
Name="CloseButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{TemplateBinding CloseButtonText}"
|
||||
IsVisible="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ui:FABorder>
|
||||
</Panel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<!-- Handle hidden dialog -->
|
||||
<Style Selector="^:hidden /template/ Panel#LayoutRoot">
|
||||
<Style.Animations>
|
||||
<Animation FillMode="Forward" Duration="00:00:00.167">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="Opacity" Value="1.0" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="Opacity" Value="0.0" />
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
<Style Selector="^:hidden /template/ Border#Container">
|
||||
<Style.Animations>
|
||||
<Animation FillMode="Forward" Duration="00:00:00.167">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="1.0" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="1.0" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%" KeySpline="0,0 0,1">
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="1.05" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="1.05" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
|
||||
<!-- Handle open dialog -->
|
||||
<Style Selector="^:open /template/ Panel#LayoutRoot">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Style.Animations>
|
||||
<!--
|
||||
Animation applies with priority of LocalValue
|
||||
To overrule the IsVisible=False in :hidden, set
|
||||
IsVisible=True in BOTH KeyFrames here
|
||||
-->
|
||||
<Animation FillMode="Forward" Duration="00:00:00.250">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Opacity" Value="0.0" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Opacity" Value="1.0" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
<Style Selector="^:open /template/ Border#Container">
|
||||
<Style.Animations>
|
||||
<Animation FillMode="Forward" Duration="00:00:00.250">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="1.05" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="1.05" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%" KeySpline="0,0 0,1">
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="1.00" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="1.00" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
|
||||
<!-- Handle showing smoke layer -->
|
||||
<Style Selector="^:nosmokelayer /template/ Panel#LayoutRoot">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
</Style>
|
||||
|
||||
<!-- Handle FullDialogSizing -->
|
||||
<Style Selector="^:fullsize /template/ ui|FABorder#BackgroundElement">
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- Primary Button Only -->
|
||||
<Style Selector="^:primary /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
</Style>
|
||||
<Style Selector="^:primary /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:primary /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
|
||||
<!-- Secondary Button Only -->
|
||||
<Style Selector="^:secondary /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:secondary /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
</Style>
|
||||
<Style Selector="^:secondary /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
|
||||
<!-- Close Button Only -->
|
||||
<Style Selector="^:close /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:close /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:close /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
</Style>
|
||||
|
||||
<!-- Margins are defined by ContentDialogButtonSpacing (8) -->
|
||||
|
||||
<!-- Primary and Secondary -->
|
||||
<Style Selector="^:primary:secondary /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="0 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="4 0 0 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
|
||||
<!-- Primary and Close Buttons -->
|
||||
<Style Selector="^:primary:close /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="0 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:close /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:close /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="4 0 0 0" />
|
||||
</Style>
|
||||
|
||||
<!-- Primary and Secondary Buttons -->
|
||||
<Style Selector="^:primary:secondary /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="0 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="4 0 0 0" />
|
||||
</Style>
|
||||
|
||||
<!-- Secondary and Close Buttons -->
|
||||
<Style Selector="^:secondary:close /template/ Button#Secondary">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="0 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:secondary:close /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:secondary:close /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="4 0 0 0" />
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- All Buttons -->
|
||||
<Style Selector="^:primary:secondary:close /template/ Button#PrimaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
<Setter Property="Margin" Value="0 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary:close /template/ Button#SecondaryButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter Property="Margin" Value="4 0 4 0" />
|
||||
</Style>
|
||||
<Style Selector="^:primary:secondary:close /template/ Button#CloseButton">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
<Setter Property="Grid.Column" Value="3" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
<Setter Property="Margin" Value="4 0 0 0" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class BitmapIcon : FluentAvalonia.UI.Controls.BitmapIcon
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class BitmapIconSource : FluentAvalonia.UI.Controls.BitmapIconSource
|
||||
{
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class ContentIcon : FluentAvalonia.UI.Controls.FAIconElement
|
||||
get => GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(ContentTemplateProperty);
|
||||
@@ -36,7 +37,6 @@ public class ContentIcon : FluentAvalonia.UI.Controls.FAIconElement
|
||||
}
|
||||
|
||||
return base.MeasureOverride(availableSize);
|
||||
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs args)
|
||||
@@ -58,6 +58,7 @@ public class ContentIcon : FluentAvalonia.UI.Controls.FAIconElement
|
||||
|
||||
base.OnDetachedFromLogicalTree(args);
|
||||
}
|
||||
|
||||
private void CreateContent()
|
||||
{
|
||||
content = new ContentControl();
|
||||
|
||||
@@ -18,6 +18,7 @@ public class ContentIconSource : FluentAvalonia.UI.Controls.IconSource
|
||||
get => GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(ContentTemplateProperty);
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class FAIconElement : FluentAvalonia.UI.Controls.FAIconElement
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class FAPathIcon : FluentAvalonia.UI.Controls.FAPathIcon
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class FontIcon : FluentAvalonia.UI.Controls.FontIcon
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
namespace Kromek.UI.Avalonia.Controls
|
||||
{
|
||||
|
||||
public class FontIconSource : FluentAvalonia.UI.Controls.FontIconSource
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class ImageIcon : FluentAvalonia.UI.Controls.ImageIcon
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class ImageIconSource : FluentAvalonia.UI.Controls.ImageIconSource
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,12 +1,5 @@
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Metadata;
|
||||
using Avalonia;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class PathIconSource : FluentAvalonia.UI.Controls.PathIconSource
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class SymbolIcon : FluentAvalonia.UI.Controls.SymbolIcon
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
public class SymbolIconSource : FluentAvalonia.UI.Controls.SymbolIconSource
|
||||
{
|
||||
|
||||
}
|
||||
@@ -4,8 +4,6 @@ using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Kromek.UI.Avalonia.Controls;
|
||||
using System;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
@@ -157,7 +155,6 @@ public class PersonPicture : TemplatedControl
|
||||
|
||||
if (change.Property == ProfilePictureProperty)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +294,7 @@ public class PersonPicture : TemplatedControl
|
||||
PseudoClasses.Set(":NoBadge", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBadgeNumber()
|
||||
{
|
||||
if (badgingEllipse == null || badgeNumberTextBlock == null)
|
||||
@@ -322,6 +320,7 @@ public class PersonPicture : TemplatedControl
|
||||
badgeNumberTextBlock.Text = "99+";
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDisplayName()
|
||||
{
|
||||
displayNameInitials = PersonPictureInitialsGenerator.InitialsFromDisplayName(DisplayName);
|
||||
|
||||
@@ -22,18 +22,21 @@ internal class PersonPictureInitialsGenerator
|
||||
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;
|
||||
}
|
||||
@@ -44,7 +47,6 @@ internal class PersonPictureInitialsGenerator
|
||||
|
||||
public static PersonPictureCharacterType GetCharacterType(char character)
|
||||
{
|
||||
|
||||
// IPA Extensions
|
||||
if ((character >= 0x0250) && (character <= 0x02AF))
|
||||
{
|
||||
@@ -317,6 +319,7 @@ internal class PersonPictureInitialsGenerator
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetFirstFullCharacter(string str)
|
||||
{
|
||||
int start = 0;
|
||||
@@ -385,6 +388,7 @@ internal class PersonPictureInitialsGenerator
|
||||
|
||||
return value.Substring(startIndex, length);
|
||||
}
|
||||
|
||||
private static string[] Split(string source, char delim, int maxIterations = 25)
|
||||
{
|
||||
return source.Split(new[] { delim }, maxIterations);
|
||||
|
||||
@@ -8,7 +8,6 @@ public class PersonPictureTemplateSettings : AvaloniaObject
|
||||
private static readonly StyledProperty<ImageBrush?> ActualImageBrushProperty =
|
||||
AvaloniaProperty.Register<PersonPictureTemplateSettings, ImageBrush?>(nameof(ActualImageBrush));
|
||||
|
||||
|
||||
private static readonly StyledProperty<string> ActualInitialsProperty =
|
||||
AvaloniaProperty.Register<PersonPictureTemplateSettings, string>(nameof(ActualInitials));
|
||||
|
||||
|
||||
@@ -14,131 +14,4 @@
|
||||
<x:Double x:Key="SettingsExpanderItemIconSize">24</x:Double>
|
||||
<x:Double x:Key="SettingsExpanderItemActionIconSize">18</x:Double>
|
||||
<x:Double x:Key="SettingsExpanderItemAdaptiveWidthTrigger">460</x:Double>
|
||||
<ControlTheme x:Key="{x:Type controls:SettingsExpanderItem}" TargetType="controls:SettingsExpanderItem">
|
||||
<Setter Property="Background" Value="{DynamicResource ExpanderHeaderBackground}" />
|
||||
<Setter Property="Padding" Value="{DynamicResource SettingsExpanderItemPadding}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource SettingsExpanderItemMinHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<ui:FABorder
|
||||
Name="Root"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ui:FABorder.Transitions>
|
||||
<Transitions>
|
||||
<BrushTransition Property="Background" Duration="00:00:00.083" />
|
||||
<BrushTransition Property="BorderBrush" Duration="00:00:00.083" />
|
||||
</Transitions>
|
||||
</ui:FABorder.Transitions>
|
||||
<Grid ColumnDefinitions="*,Auto,Auto" RowDefinitions="*,Auto">
|
||||
<Viewbox
|
||||
Name="IconHost"
|
||||
Width="{DynamicResource SettingsExpanderItemIconSize}"
|
||||
Height="{DynamicResource SettingsExpanderItemIconSize}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="False">
|
||||
<ContentPresenter Name="IconPresenter" Content="{Binding TemplateSettings.Icon, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Viewbox>
|
||||
<StackPanel
|
||||
Name="HeaderRegion"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="Center">
|
||||
<ContentPresenter
|
||||
Name="ContentPresenter"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
IsVisible="False" />
|
||||
<ContentPresenter
|
||||
Name="DescriptionText"
|
||||
Content="{TemplateBinding Description}"
|
||||
FontSize="{DynamicResource CaptionTextBlockFontSize}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap"
|
||||
Theme="{StaticResource CaptionTextBlockStyle}" />
|
||||
</StackPanel>
|
||||
<ContentPresenter
|
||||
Name="FooterPresenter"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="1"
|
||||
Margin="{DynamicResource SettingsExpanderItemFooterMargin}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Footer}"
|
||||
ContentTemplate="{TemplateBinding FooterTemplate}"
|
||||
IsVisible="False" />
|
||||
<Viewbox
|
||||
Name="ActionIconHost"
|
||||
Grid.Column="2"
|
||||
Width="{DynamicResource SettingsExpanderItemActionIconSize}"
|
||||
Height="{DynamicResource SettingsExpanderItemActionIconSize}"
|
||||
IsVisible="False">
|
||||
<ContentPresenter Name="ExpandChevronActionIconContainer" Content="{Binding TemplateSettings.ActionIcon, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</ui:FABorder>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:empty /template/ ItemsPresenter#ItemsHost">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:nth-last-child(1) /template/ ui|FABorder#Root">
|
||||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource BottomCornerRadiusFilterConverter}}" />
|
||||
</Style>
|
||||
<Style Selector="^:footer /template/ ContentPresenter#FooterPresenter">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:footerBottom /template/ ContentPresenter#FooterPresenter">
|
||||
<Setter Property="Grid.Row" Value="1" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemBottomFooterMargin}" />
|
||||
</Style>
|
||||
<Style Selector="^:actionIcon /template/ Viewbox#ActionIconHost">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:content /template/ ContentPresenter#ContentPresenter">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:icon">
|
||||
<Style Selector="^ /template/ Viewbox#IconHost">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ StackPanel#HeaderRegion">
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemContentMargin}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:iconPlaceholder">
|
||||
<Style Selector="^ /template/ StackPanel#HeaderRegion">
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemContentMargin}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:allowClick">
|
||||
<Style Selector="^:pointerover /template/ ui|FABorder#Root">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ ui|FABorder#Root">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorTertiaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:disabled">
|
||||
<Style Selector="^ /template/ ui|FABorder#Root">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#DescriptionText">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -4,7 +4,6 @@
|
||||
<FontFamily x:Key="FluentThemeFontFamily">/Fonts/#FluentSystemIcons-Resizable</FontFamily>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="../CarouselView/CarouselView.axaml" />
|
||||
<MergeResourceInclude Source="../ContentDialog/ContentDialog.axaml" />
|
||||
<MergeResourceInclude Source="../SettingsExpander/SettingsExpander.axaml" />
|
||||
<MergeResourceInclude Source="../SettingsExpander/SettingsExpanderItem.axaml" />
|
||||
<MergeResourceInclude Source="../PersonPicture/PersonPicture.axaml" />
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.2.999-cibuild0048140-alpha" />
|
||||
<PackageReference Include="Avalonia.Labs.Controls" Version="11.0.10.1" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview1" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user