Remove new contact fromm menu list.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
@@ -7,14 +6,11 @@ using Wino.Core.Domain.MenuItems;
|
||||
using Wino.Core.Domain.Models;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
using Wino.Core.ViewModels;
|
||||
using Wino.Messaging.Client.Contacts;
|
||||
|
||||
namespace Wino.Mail.WinUI.ViewModels;
|
||||
|
||||
public sealed class ContactsShellClient(INavigationService navigationService) : CoreBaseViewModel, IShellClient
|
||||
{
|
||||
private readonly NewContactMenuItem _newContactMenuItem = new();
|
||||
|
||||
public WinoApplicationMode Mode => WinoApplicationMode.Contacts;
|
||||
public MenuItemCollection? MenuItems { get; private set; }
|
||||
public object? SelectedMenuItem { get; set; }
|
||||
@@ -24,22 +20,12 @@ public sealed class ContactsShellClient(INavigationService navigationService) :
|
||||
{
|
||||
base.OnDispatcherAssigned();
|
||||
MenuItems ??= new MenuItemCollection(Dispatcher);
|
||||
|
||||
if (MenuItems.Count == 0)
|
||||
{
|
||||
MenuItems.Add(_newContactMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate(ShellModeActivationContext activationContext)
|
||||
{
|
||||
OnNavigatedTo(NavigationMode.New, activationContext);
|
||||
|
||||
if (MenuItems?.Count == 0)
|
||||
{
|
||||
MenuItems.Add(_newContactMenuItem);
|
||||
}
|
||||
|
||||
navigationService.Navigate(WinoPage.ContactsPage, null, NavigationReferenceFrame.InnerShellFrame);
|
||||
}
|
||||
|
||||
@@ -51,22 +37,10 @@ public sealed class ContactsShellClient(INavigationService navigationService) :
|
||||
public void PrepareForShellShutdown()
|
||||
{
|
||||
SelectedMenuItem = null;
|
||||
if (MenuItems != null)
|
||||
{
|
||||
MenuItems.Clear();
|
||||
MenuItems.Add(_newContactMenuItem);
|
||||
}
|
||||
MenuItems?.Clear();
|
||||
}
|
||||
|
||||
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem)
|
||||
{
|
||||
if (menuItem is NewContactMenuItem)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new NewContactRequested());
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem) => Task.CompletedTask;
|
||||
|
||||
public Task HandleNavigationSelectionChangedAsync(IMenuItem? menuItem) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user