diff --git a/Wino.Calendar.ViewModels/CalendarAppShellViewModel.cs b/Wino.Calendar.ViewModels/CalendarAppShellViewModel.cs
index 9b98cc15..9c66f59c 100644
--- a/Wino.Calendar.ViewModels/CalendarAppShellViewModel.cs
+++ b/Wino.Calendar.ViewModels/CalendarAppShellViewModel.cs
@@ -87,7 +87,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
private readonly SettingsItem _settingsItem = new();
private readonly StoreUpdateMenuItem _storeUpdateMenuItem = new();
- private readonly NewCalendarEventMenuItem _newEventMenuItem = new();
// For updating account calendars asynchronously.
private SemaphoreSlim _accountCalendarUpdateSemaphoreSlim = new(1);
@@ -126,7 +125,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
AccountCalendarStateService.Dispatcher = Dispatcher;
MenuItems = new MenuItemCollection(Dispatcher);
FooterItems = new MenuItemCollection(Dispatcher);
- MenuItems.Add(_newEventMenuItem);
_ = RefreshFooterItemsAsync(false);
}
diff --git a/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml b/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
index 08579c05..16af1345 100644
--- a/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
+++ b/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
@@ -347,14 +347,18 @@
-
+
-
-
-
+
+
@@ -365,7 +369,6 @@
@@ -386,12 +389,6 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Visibility="Collapsed" />
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wino.Mail.WinUI/Styles/DataTemplates.xaml b/Wino.Mail.WinUI/Styles/DataTemplates.xaml
index 3abe45d7..d4b22582 100644
--- a/Wino.Mail.WinUI/Styles/DataTemplates.xaml
+++ b/Wino.Mail.WinUI/Styles/DataTemplates.xaml
@@ -55,9 +55,7 @@
-
+
diff --git a/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml b/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml
index 7335a0eb..2ab6d85d 100644
--- a/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml
+++ b/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml
@@ -22,23 +22,6 @@
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
@@ -66,8 +49,6 @@
@@ -203,14 +184,35 @@
+
+
+
+
+
+
+
+
diff --git a/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml.cs b/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml.cs
index 70ba10c5..367ed9c0 100644
--- a/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml.cs
+++ b/Wino.Mail.WinUI/Views/Calendar/CalendarAppShell.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
+using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
@@ -8,9 +9,11 @@ using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Navigation;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
+using Wino.Core.Domain.MenuItems;
using Wino.Core.Domain.Models;
using Wino.Mail.Views.Abstract;
using Wino.Messaging.Client.Calendar;
+using Windows.System;
namespace Wino.Mail.WinUI.Views.Calendar;
@@ -50,6 +53,21 @@ public sealed partial class CalendarAppShell : CalendarAppShellAbstract,
private void NextDateClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new GoNextDateRequestedMessage());
+ private async void NewCalendarEventNavigationItemTapped(object sender, TappedRoutedEventArgs e)
+ {
+ e.Handled = true;
+ await InvokeNewCalendarEventAsync();
+ }
+
+ private async void NewCalendarEventNavigationItemKeyDown(object sender, KeyRoutedEventArgs e)
+ {
+ if (e.Key is not (VirtualKey.Enter or VirtualKey.Space))
+ return;
+
+ e.Handled = true;
+ await InvokeNewCalendarEventAsync();
+ }
+
private async void NavigationViewItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
if (args.InvokedItemContainer is FrameworkElement { DataContext: IMenuItem menuItem })
@@ -61,6 +79,9 @@ public sealed partial class CalendarAppShell : CalendarAppShellAbstract,
private void NavigationViewDisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
=> UpdateNavigationPaneLayout(args.DisplayMode);
+ private Task InvokeNewCalendarEventAsync()
+ => ViewModel.HandleNavigationItemInvokedAsync(new NewCalendarEventMenuItem());
+
private void UpdateNavigationPaneLayout(NavigationViewDisplayMode displayMode)
{
var paneContentVisibility = displayMode == NavigationViewDisplayMode.Expanded && navigationView.IsPaneOpen
diff --git a/Wino.Mail.WinUI/Views/WinoAppShell.xaml b/Wino.Mail.WinUI/Views/WinoAppShell.xaml
index 021ac589..b173aa20 100644
--- a/Wino.Mail.WinUI/Views/WinoAppShell.xaml
+++ b/Wino.Mail.WinUI/Views/WinoAppShell.xaml
@@ -377,23 +377,6 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Spacing="6"
+ Visibility="Collapsed">
WeakReferenceMessenger.Default.Send(new GoPreviousDateRequestedMessage());
private void NextDateClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new GoNextDateRequestedMessage());
+ private Task InvokeNewCalendarEventAsync()
+ => ViewModel.CalendarClient.HandleNavigationItemInvokedAsync(new NewCalendarEventMenuItem());
+
public void Receive(CalendarDisplayTypeChangedMessage message) => ManageCalendarDisplayType(message.NewDisplayType);
private async void NavigationViewItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)