More bug fixes

This commit is contained in:
TheXamlGuy
2024-07-10 22:18:32 +01:00
parent bd51de3245
commit 62f8c8b084
17 changed files with 57 additions and 84 deletions
+1 -1
Submodule Toolkit updated: 38e2913cab...d87fa37d09
@@ -5,6 +5,7 @@
xmlns:vm="using:Wallet" xmlns:vm="using:Wallet"
x:DataType="vm:CreateItemNavigationViewModel" x:DataType="vm:CreateItemNavigationViewModel"
Content="New Item" Content="New Item"
IsSelected="False"
NavigationViewExtension.IsItemInvokedEnabled="True" NavigationViewExtension.IsItemInvokedEnabled="True"
SelectsOnInvoked="False"> SelectsOnInvoked="False">
<Interaction.Behaviors> <Interaction.Behaviors>
+20 -42
View File
@@ -10,7 +10,27 @@
FooterMenuItemsSource="{Binding Footer}" FooterMenuItemsSource="{Binding Footer}"
IsSettingsVisible="False" IsSettingsVisible="False"
MenuItemTemplate="{Binding Template}" MenuItemTemplate="{Binding Template}"
MenuItemsSource="{Binding}"
SelectedItem="{Binding SelectedItem}"> SelectedItem="{Binding SelectedItem}">
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
<InvokeNavigationViewItemAction SelectedIndex="1" />
</DataTriggerBehavior>
</Interaction.Behaviors>
<NavigationView.PaneHeader>
<Border
Margin="12,0,0,0"
Padding="12,4,12,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="{DynamicResource AccentFillColorDefaultBrush}"
CornerRadius="12">
<TextBlock
FontSize="10"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="PREVIEW 4" />
</Border>
</NavigationView.PaneHeader>
<NavigationView.PaneCustomContent> <NavigationView.PaneCustomContent>
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<ContentControl Grid.Row="0"> <ContentControl Grid.Row="0">
@@ -36,48 +56,6 @@
</AttachedBehaviour> </AttachedBehaviour>
</Interaction.Behaviors> </Interaction.Behaviors>
</Frame> </Frame>
<!--<Interaction.Behaviors>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
<InvokeNavigationViewItemAction SelectedIndex="1" />
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsSelected}" Value="True">
<InvokeNavigationViewItemAction SelectedIndex="1" />
</DataTriggerBehavior>
</Interaction.Behaviors>
<NavigationView.PaneHeader>
<Border
Margin="12,0,0,0"
Padding="12,4,12,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="{DynamicResource AccentFillColorDefaultBrush}"
CornerRadius="12">
<TextBlock
FontSize="10"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="{ReflectionBinding SelectedItem.Name}" />
</Border>
</NavigationView.PaneHeader>
<NavigationView.PaneCustomContent>
<Grid RowDefinitions="*,Auto">
<NavigationViewItemSeparator Grid.Row="1" />
</Grid>
</NavigationView.PaneCustomContent>
<NavigationView.Resources>
<CornerRadius x:Key="NavigationViewContentGridCornerRadius">0</CornerRadius>
<Thickness x:Key="NavigationViewContentGridBorderThickness">1,0,0,0</Thickness>
</NavigationView.Resources>
<Frame>
<Interaction.Behaviors>
<AttachedBehaviour>
<NavigateRegionAction Name="Main">
<NavigateAction Region="Main" Route="Wallet" />
</NavigateRegionAction>
</AttachedBehaviour>
</Interaction.Behaviors>
</Frame>-->
</NavigationView> </NavigationView>
</UserControl> </UserControl>
+1 -1
View File
@@ -10,7 +10,7 @@ public partial class CreateItemNavigationViewModel(IServiceProvider provider,
ISubscriber subscriber, ISubscriber subscriber,
IDisposer disposer, IDisposer disposer,
NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer), NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
IWalletNavigationViewModel INavigationViewModel
{ {
[ObservableProperty] [ObservableProperty]
private bool isSelected; private bool isSelected;
+1 -1
View File
@@ -9,4 +9,4 @@ public partial class CreateWalletNavigationViewModel(IServiceProvider provider,
ISubscriber subscriber, ISubscriber subscriber,
IDisposer disposer) : IDisposer disposer) :
Observable(provider, factory, mediator, publisher, subscriber, disposer), Observable(provider, factory, mediator, publisher, subscriber, disposer),
IMainNavigationViewModel; INavigationViewModel;
+6 -4
View File
@@ -12,8 +12,8 @@ public abstract partial class FilterNavigationViewModel(IServiceProvider provide
IDisposer disposer, IDisposer disposer,
int key, int key,
string value) : string value) :
ObservableCollection<IWalletNavigationViewModel, int, string>(provider, factory, mediator, publisher, subscriber, disposer, key, value), ObservableCollection<INavigationViewModel, int, string>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
IWalletNavigationViewModel, INavigationViewModel,
INotificationHandler<ActivatedEventArgs<Wallet>>, INotificationHandler<ActivatedEventArgs<Wallet>>,
INotificationHandler<DeactivatedEventArgs<Wallet>>, INotificationHandler<DeactivatedEventArgs<Wallet>>,
INotificationHandler<NotifyEventArgs<Item<int>>> INotificationHandler<NotifyEventArgs<Item<int>>>
@@ -38,6 +38,7 @@ public abstract partial class FilterNavigationViewModel(IServiceProvider provide
{ {
IsSelected = false; IsSelected = false;
IsActivated = false; IsActivated = false;
return Task.CompletedTask; return Task.CompletedTask;
} }
@@ -58,11 +59,11 @@ public abstract partial class FilterNavigationViewModel<TWalletNavigation>(IServ
int key, int key,
string value) : string value) :
ObservableCollection<TWalletNavigation, int, string>(provider, factory, mediator, publisher, subscriber, disposer, key, value), ObservableCollection<TWalletNavigation, int, string>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
IWalletNavigationViewModel, INavigationViewModel,
INotificationHandler<ActivatedEventArgs<Wallet>>, INotificationHandler<ActivatedEventArgs<Wallet>>,
INotificationHandler<DeactivatedEventArgs<Wallet>> INotificationHandler<DeactivatedEventArgs<Wallet>>
where TWalletNavigation : where TWalletNavigation :
IWalletNavigationViewModel INavigationViewModel
{ {
[ObservableProperty] [ObservableProperty]
private bool isActivated; private bool isActivated;
@@ -74,6 +75,7 @@ public abstract partial class FilterNavigationViewModel<TWalletNavigation>(IServ
{ {
IsSelected = false; IsSelected = false;
IsActivated = false; IsActivated = false;
return Task.CompletedTask; return Task.CompletedTask;
} }
+1 -1
View File
@@ -3,7 +3,7 @@
namespace Wallet; namespace Wallet;
public partial class FooterViewModel : public partial class FooterViewModel :
ObservableCollection<IMainNavigationViewModel> ObservableCollection<INavigationViewModel>
{ {
public FooterViewModel(IServiceProvider provider, public FooterViewModel(IServiceProvider provider,
IServiceFactory factory, IServiceFactory factory,
-3
View File
@@ -1,3 +0,0 @@
namespace Wallet;
public interface IMainNavigationViewModel : IDisposable;
+4
View File
@@ -0,0 +1,4 @@
namespace Wallet;
public interface INavigationViewModel :
IDisposable;
+2 -2
View File
@@ -1,7 +1,7 @@
using Toolkit.Foundation; using Avalonia.Controls;
namespace Wallet; namespace Wallet;
public interface IWalletNavigationViewModel : public interface IWalletNavigationViewModel :
ISelectable, ISelectable,
IDisposable; INavigationViewModel;
+1 -1
View File
@@ -18,7 +18,7 @@ public partial class ItemCommandHeaderViewModel(IServiceProvider provider,
{ {
if (args.Sender is ItemCommandHeaderCollection commandCollection) if (args.Sender is ItemCommandHeaderCollection commandCollection)
{ {
Clear(args => Reset(args =>
{ {
foreach (IDisposable command in commandCollection) foreach (IDisposable command in commandCollection)
{ {
+8 -3
View File
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
namespace Wallet; namespace Wallet;
public partial class MainViewModel : public partial class MainViewModel :
ObservableCollection<IMainNavigationViewModel>, ObservableCollection<INavigationViewModel>,
INotificationHandler<SelectionEventArgs<IWalletNavigationViewModel>> INotificationHandler<SelectionEventArgs<IWalletNavigationViewModel>>
{ {
[ObservableProperty] [ObservableProperty]
@@ -27,9 +27,14 @@ public partial class MainViewModel :
public Task Handle(SelectionEventArgs<IWalletNavigationViewModel> args) public Task Handle(SelectionEventArgs<IWalletNavigationViewModel> args)
{ {
if (args.Sender is not null) if (args.Sender is WalletNavigationViewModel wallet)
{ {
SelectedItem = null; Reset(args => args.SetSource(wallet), false);
SelectedItem = wallet;
}
else
{
Clear(false);
} }
return Task.CompletedTask; return Task.CompletedTask;
+1 -1
View File
@@ -10,7 +10,7 @@ public partial class ManageNavigationViewModel(IServiceProvider provider,
ISubscriber subscriber, ISubscriber subscriber,
IDisposer disposer) : IDisposer disposer) :
Observable(provider, factory, mediator, publisher, subscriber, disposer), Observable(provider, factory, mediator, publisher, subscriber, disposer),
IMainNavigationViewModel, INavigationViewModel,
ISelectable ISelectable
{ {
[ObservableProperty] [ObservableProperty]
+1 -1
View File
@@ -4,7 +4,7 @@ namespace Wallet;
public partial class ManageViewModel : public partial class ManageViewModel :
ObservableCollection, ObservableCollection,
IMainNavigationViewModel INavigationViewModel
{ {
public ManageViewModel(IServiceProvider provider, public ManageViewModel(IServiceProvider provider,
IServiceFactory factory, IServiceFactory factory,
-13
View File
@@ -50,17 +50,4 @@ public partial class OpenWalletViewModel :
} }
} }
} }
//public override async Task OnActivated()
//{
// Publisher.Publish(Activated.As<Wallet>());
// await base.OnActivated();
//}
//public override async Task OnDeactivated()
//{
// Publisher.Publish(Deactivated.As<Wallet>());
// await base.OnDeactivated();
//}
} }
@@ -6,7 +6,7 @@ namespace Wallet;
[Notification(typeof(InsertEventArgs<IWalletNavigationViewModel>), nameof(WalletNavigationCollectionViewModel))] [Notification(typeof(InsertEventArgs<IWalletNavigationViewModel>), nameof(WalletNavigationCollectionViewModel))]
public partial class WalletNavigationCollectionViewModel : public partial class WalletNavigationCollectionViewModel :
ObservableCollection<IWalletNavigationViewModel>, ObservableCollection<IWalletNavigationViewModel>,
INotificationHandler<SelectionEventArgs<IMainNavigationViewModel>> INotificationHandler<SelectionEventArgs<INavigationViewModel>>
{ {
public WalletNavigationCollectionViewModel(IServiceProvider provider, public WalletNavigationCollectionViewModel(IServiceProvider provider,
IServiceFactory factory, IServiceFactory factory,
@@ -21,9 +21,9 @@ public partial class WalletNavigationCollectionViewModel :
public IContentTemplate Template { get; set; } public IContentTemplate Template { get; set; }
public Task Handle(SelectionEventArgs<IMainNavigationViewModel> args) public Task Handle(SelectionEventArgs<INavigationViewModel> args)
{ {
if (args.Sender is not null) if (args.Sender is ManageNavigationViewModel)
{ {
SelectedItem = null; SelectedItem = null;
} }
+6 -7
View File
@@ -5,7 +5,7 @@ using Toolkit.Foundation;
namespace Wallet; namespace Wallet;
public partial class WalletNavigationViewModel : public partial class WalletNavigationViewModel :
ObservableCollection<IWalletNavigationViewModel>, ObservableCollection<INavigationViewModel>,
IWalletNavigationViewModel, IWalletNavigationViewModel,
INotificationHandler<OpenedEventArgs<Wallet>>, INotificationHandler<OpenedEventArgs<Wallet>>,
INotificationHandler<ClosedEventArgs<Wallet>>, INotificationHandler<ClosedEventArgs<Wallet>>,
@@ -52,14 +52,13 @@ public partial class WalletNavigationViewModel :
public Task Handle(OpenedEventArgs<Wallet> args) public Task Handle(OpenedEventArgs<Wallet> args)
{ {
//Add<CreateItemNavigationViewModel>(); Add<CreateItemNavigationViewModel>();
//Add<AllNavigationViewModel>("All", 0); Add<AllNavigationViewModel>("All", 0);
//Add<FavouritesNavigationViewModel>("Favourites", 0); Add<FavouritesNavigationViewModel>("Favourites", 0);
//Add<ArchiveNavigationViewModel>("Archive", 0); Add<ArchiveNavigationViewModel>("Archive", 0);
//Add<CategoriesNavigationViewModel>("Categories", 0); Add<CategoriesNavigationViewModel>("Categories", 0);
IsOpened = true; IsOpened = true;
Publisher.Publish(Changed.As<Item>());
return Task.CompletedTask; return Task.CompletedTask;
} }