Files
Wino-Mail/Wino.Calendar/Views/AppShell.xaml.cs

47 lines
1.5 KiB
C#
Raw Normal View History

using CommunityToolkit.Mvvm.Messaging;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Wino.Calendar.Views.Abstract;
using Wino.Messaging.Client.Calendar;
namespace Wino.Calendar.Views
{
2025-01-01 17:28:29 +01:00
public sealed partial class AppShell : AppShellAbstract,
IRecipient<CalendarDisplayTypeChangedMessage>
{
private const string STATE_HorizontalCalendar = "HorizontalCalendar";
private const string STATE_VerticalCalendar = "VerticalCalendar";
public Frame GetShellFrame() => ShellFrame;
public AppShell()
{
InitializeComponent();
Window.Current.SetTitleBar(DragArea);
2025-01-06 21:56:33 +01:00
ManageCalendarDisplayType();
}
2025-01-01 17:28:29 +01:00
private void ManageCalendarDisplayType()
{
// Go to different states based on the display type.
if (ViewModel.IsVerticalCalendar)
{
VisualStateManager.GoToState(this, STATE_VerticalCalendar, false);
}
else
{
VisualStateManager.GoToState(this, STATE_HorizontalCalendar, false);
}
}
2025-01-01 17:28:29 +01:00
private void PreviousDateClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new GoPreviousDateRequestedMessage());
2025-01-01 17:28:29 +01:00
private void NextDateClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new GoNextDateRequestedMessage());
2025-01-01 17:28:29 +01:00
public void Receive(CalendarDisplayTypeChangedMessage message)
{
2025-01-01 17:28:29 +01:00
ManageCalendarDisplayType();
}
}
}