2026-03-11 01:39:32 +01:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wino.Core.Domain;
|
|
|
|
|
using Wino.Core.Domain.Enums;
|
|
|
|
|
using Wino.Core.Domain.Interfaces;
|
|
|
|
|
using Wino.Core.Domain.MenuItems;
|
|
|
|
|
using Wino.Core.Domain.Models;
|
|
|
|
|
using Wino.Core.Domain.Models.Navigation;
|
|
|
|
|
using Wino.Core.ViewModels;
|
|
|
|
|
|
|
|
|
|
namespace Wino.Mail.WinUI.ViewModels;
|
|
|
|
|
|
|
|
|
|
public sealed class ContactsShellClient(INavigationService navigationService) : CoreBaseViewModel, IShellClient
|
|
|
|
|
{
|
|
|
|
|
public WinoApplicationMode Mode => WinoApplicationMode.Contacts;
|
|
|
|
|
public MenuItemCollection? MenuItems { get; private set; }
|
|
|
|
|
public object? SelectedMenuItem { get; set; }
|
|
|
|
|
public bool HandlesNavigationSelection => false;
|
|
|
|
|
|
|
|
|
|
protected override void OnDispatcherAssigned()
|
|
|
|
|
{
|
|
|
|
|
base.OnDispatcherAssigned();
|
|
|
|
|
MenuItems ??= new MenuItemCollection(Dispatcher);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Activate(ShellModeActivationContext activationContext)
|
|
|
|
|
{
|
|
|
|
|
OnNavigatedTo(NavigationMode.New, activationContext);
|
2026-03-27 14:45:36 +01:00
|
|
|
|
2026-03-11 01:39:32 +01:00
|
|
|
navigationService.Navigate(WinoPage.ContactsPage, null, NavigationReferenceFrame.InnerShellFrame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Deactivate()
|
|
|
|
|
{
|
|
|
|
|
OnNavigatedFrom(NavigationMode.New, null!);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 14:45:36 +01:00
|
|
|
public void PrepareForShellShutdown()
|
|
|
|
|
{
|
|
|
|
|
SelectedMenuItem = null;
|
2026-04-12 20:12:48 +02:00
|
|
|
MenuItems?.Clear();
|
2026-03-27 14:45:36 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-12 20:12:48 +02:00
|
|
|
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem) => Task.CompletedTask;
|
2026-03-11 01:39:32 +01:00
|
|
|
|
|
|
|
|
public Task HandleNavigationSelectionChangedAsync(IMenuItem? menuItem) => Task.CompletedTask;
|
|
|
|
|
}
|