Start refining the UI
This commit is contained in:
@@ -93,7 +93,7 @@ public partial class App : Application
|
||||
services.AddTemplate<CategoriesNavigationViewModel, CategoriesNavigationView>();
|
||||
services.AddTemplate<ArchiveNavigationViewModel, ArchiveNavigationView>();
|
||||
|
||||
services.AddTemplate<OpenLockerViewModel, OpenView>("OpenLocker");
|
||||
services.AddTemplate<OpenLockerViewModel, OpenLockerView>("OpenLocker");
|
||||
|
||||
services.AddScoped<LockerViewModelConfiguration>();
|
||||
|
||||
@@ -106,7 +106,7 @@ public partial class App : Application
|
||||
services.AddTemplate<CreateItemActionViewModel, CreateItemActionView>();
|
||||
services.AddTemplate<SearchLockerActionViewModel, SearchLockerActionView>();
|
||||
|
||||
services.AddTemplate<ItemCategoryCollectionViewModel, ItemCategoryCollectionView>("LockerItemCategoryCollection");
|
||||
services.AddTemplate<ItemCategoryCollectionViewModel, ItemCategoryCollectionView>("ItemCategoryCollection");
|
||||
services.AddTemplate<ItemCategoryNavigationViewModel, ItemCategoryNavigationView>();
|
||||
|
||||
services.AddHandler<AggerateLockerItemCategoryViewModelHandler>();
|
||||
@@ -126,6 +126,7 @@ public partial class App : Application
|
||||
services.AddTemplate<EditItemActionViewModel, EditItemActionView>();
|
||||
services.AddTemplate<DeleteItemActionViewModel, DeleteItemActionView>();
|
||||
|
||||
services.AddTemplate<EmptyItemCollectionViewModel, EmptyItemCollectionView>("EmptyItemCollection");
|
||||
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
||||
services.AddTemplate<ItemContentViewModel, ItemContentView>();
|
||||
services.AddTemplate<AddItemNavigationViewModel, AddItemNavigationView>();
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<Compile Update="ItemContentView.axaml.cs">
|
||||
<DependentUpon>ItemContentView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="OpenView.axaml.cs">
|
||||
<DependentUpon>OpenView.axaml</DependentUpon>
|
||||
<Compile Update="OpenLockerView.axaml.cs">
|
||||
<DependentUpon>OpenLockerView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ManageNavigationView.axaml.cs">
|
||||
<DependentUpon>ManageNavigationView.axaml</DependentUpon>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</Grid>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction Region="Left" Route="LockerItemCategoryCollection">
|
||||
<NavigateAction Region="Left" Route="ItemCategoryCollection">
|
||||
<Parameter Key="Transition" Value="FromRight" />
|
||||
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||
</NavigateAction>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.EmptyItemCollectionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:EmptyItemCollectionViewModel">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Text="Nothing to see here"
|
||||
TextAlignment="Center"
|
||||
Theme="{DynamicResource BodyStrongTextBlockStyle}" />
|
||||
<HyperlinkButton Content="Let's start securing your items">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction Region="Left" Route="ItemCategoryCollection">
|
||||
<Parameter Key="Transition" Value="FromRight" />
|
||||
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||
</NavigateAction>
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<Parameter Key="test" Value="{x:True}" />
|
||||
<Parameter Key="State" Value="{x:Static vm:ItemState.Write}" />
|
||||
</NavigateAction>
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class EmptyItemCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public EmptyItemCollectionView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -4,11 +4,32 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemCollectionViewModel">
|
||||
<Interaction.Behaviors>
|
||||
<AttachedBehaviour>
|
||||
<ConditionAction>
|
||||
<ConditionAction.Condition>
|
||||
<ConditionalExpression ForwardChaining="And">
|
||||
<ComparisonCondition
|
||||
LeftOperand="{Binding Count}"
|
||||
Operator="LessThanOrEqual"
|
||||
RightOperand="0" />
|
||||
</ConditionalExpression>
|
||||
</ConditionAction.Condition>
|
||||
<NavigateAction Region="{Binding Named, StringFormat='{}{0}:Content'}" Route="EmptyItemCollection" />
|
||||
</ConditionAction>
|
||||
</AttachedBehaviour>
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding Count}"
|
||||
ComparisonCondition="LessThanOrEqual"
|
||||
Value="0">
|
||||
<NavigateAction Region="{Binding Named, StringFormat='{}{0}:Content'}" Route="EmptyItemCollection" />
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<ListBox
|
||||
Margin="2,-1,0,0"
|
||||
AutoScrollToSelectedItem="True"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
||||
SelectedItem="{Binding SelectedItem}"
|
||||
SelectionMode="Single" />
|
||||
</UserControl>
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemHeaderViewModel">
|
||||
<StackPanel Grid.Column="1" Spacing="18">
|
||||
<StackPanel Grid.Column="1" Spacing="12">
|
||||
<PersonPicture
|
||||
Width="96"
|
||||
Height="96"
|
||||
Width="144"
|
||||
Height="144"
|
||||
DisplayName="{Binding Value}" />
|
||||
<TextBox
|
||||
MaxWidth="360"
|
||||
|
||||
@@ -24,6 +24,18 @@
|
||||
<NavigateBackAction Region="Left" />
|
||||
</ConditionAction>
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding SelectedItem}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="{x:Null}">
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<Parameter Key="test" Value="{x:True}" />
|
||||
<Parameter Key="State" Value="{x:Static vm:ItemState.Write}" />
|
||||
</NavigateAction>
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<ScrollViewer Padding="12,12,12,0">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}">
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
||||
</ConditionalExpression>
|
||||
</ConditionAction.Condition>
|
||||
<NavigateAction Region="Main" Route="OpenLocker" />
|
||||
<NavigateAction Region="Main" Route="OpenLocker">
|
||||
<Parameter Key="Name" Value="{Binding Name}" />
|
||||
</NavigateAction>
|
||||
<ChangePropertyAction
|
||||
PropertyName="SelectsOnInvoked"
|
||||
TargetObject="{Binding #NavigationViewItem}"
|
||||
@@ -47,7 +49,9 @@
|
||||
<ComparisonCondition LeftOperand="{Binding Opened}" RightOperand="False" />
|
||||
</ConditionalExpression>
|
||||
</ConditionAction.Condition>
|
||||
<NavigateAction Region="Main" Route="OpenLocker" />
|
||||
<NavigateAction Region="Main" Route="OpenLocker">
|
||||
<Parameter Key="Name" Value="{Binding Name}" />
|
||||
</NavigateAction>
|
||||
</ConditionAction>
|
||||
<ConditionAction>
|
||||
<ConditionAction.Condition>
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.OpenView"
|
||||
x:Class="Bitvault.Avalonia.OpenLockerView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:OpenLockerViewModel">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="12">
|
||||
<PersonPicture
|
||||
Width="144"
|
||||
Height="144"
|
||||
Margin="0,-144,0,0"
|
||||
DisplayName="{Binding Name}" />
|
||||
<TextBlock
|
||||
Text="{Binding Name}"
|
||||
TextAlignment="Center"
|
||||
Theme="{DynamicResource SubtitleTextBlockStyle}" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
Width="360"
|
||||
Classes="revealPasswordButton"
|
||||
PasswordChar="●"
|
||||
Text="{Binding Password}">
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class OpenLockerView : UserControl
|
||||
{
|
||||
public OpenLockerView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class OpenView : UserControl
|
||||
{
|
||||
public OpenView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class EmptyItemCollectionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string named = $"{named}";
|
||||
}
|
||||
@@ -10,6 +10,9 @@ public partial class ItemCollectionViewModel :
|
||||
INotificationHandler<NotifyEventArgs<Search>>,
|
||||
IBackStack
|
||||
{
|
||||
[ObservableProperty]
|
||||
public string? named;
|
||||
|
||||
private LockerViewModelConfiguration configuration;
|
||||
|
||||
public ItemCollectionViewModel(IServiceProvider provider,
|
||||
@@ -19,20 +22,18 @@ public partial class ItemCollectionViewModel :
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named,
|
||||
LockerViewModelConfiguration configuration,
|
||||
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Named = $"{named}";
|
||||
|
||||
this.configuration = configuration with { Filter = filter };
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public override Task OnDeactivated()
|
||||
{
|
||||
return base.OnDeactivated();
|
||||
}
|
||||
|
||||
public Task Handle(NotifyEventArgs<Filter> args)
|
||||
{
|
||||
if (args.Value is Filter filter)
|
||||
@@ -66,6 +67,10 @@ public partial class ItemCollectionViewModel :
|
||||
return base.OnActivated();
|
||||
}
|
||||
|
||||
public override Task OnDeactivated()
|
||||
{
|
||||
return base.OnDeactivated();
|
||||
}
|
||||
protected override IAggerate OnAggerate(object? key) =>
|
||||
Aggerate.With<ItemNavigationViewModel, LockerViewModelConfiguration>(configuration)
|
||||
with { Key = key };
|
||||
|
||||
@@ -67,6 +67,11 @@ public partial class ItemViewModel :
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>())));
|
||||
base.Dispose();
|
||||
}
|
||||
public Task Handle(CancelEventArgs<Item> args)
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>
|
||||
|
||||
@@ -9,9 +9,13 @@ public partial class OpenLockerViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) :
|
||||
IDisposer disposer,
|
||||
string name) :
|
||||
Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string? name = name;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? password;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user