Shell improvements.
This commit is contained in:
@@ -1,38 +1,32 @@
|
||||
<UserControl
|
||||
<controls:Segmented
|
||||
x:Class="Wino.Mail.WinUI.Controls.AppModeFooterSwitcherControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Loaded="ControlLoaded"
|
||||
SelectionChanged="ModeSegmentedControlSelectionChanged"
|
||||
Unloaded="ControlUnloaded">
|
||||
|
||||
<Grid>
|
||||
<controls:Segmented
|
||||
x:Name="ModeSegmentedControl"
|
||||
HorizontalAlignment="Stretch"
|
||||
SelectionChanged="ModeSegmentedControlSelectionChanged">
|
||||
<controls:SegmentedItem ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeMail, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Mail" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeCalendar, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Calendar" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem ToolTipService.ToolTip="{x:Bind domain:Translator.ContactsPage_Title, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem ToolTipService.ToolTip="{x:Bind domain:Translator.MenuSettings, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Setting" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
</controls:Segmented>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeMail, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Mail" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeCalendar, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Calendar" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.ContactsPage_Title, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.MenuSettings, Mode=OneWay}">
|
||||
<controls:SegmentedItem.Icon>
|
||||
<SymbolIcon Symbol="Setting" />
|
||||
</controls:SegmentedItem.Icon>
|
||||
</controls:SegmentedItem>
|
||||
</controls:Segmented>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
@@ -8,12 +8,25 @@ using Wino.Core.Domain;
|
||||
|
||||
namespace Wino.Mail.WinUI.Controls;
|
||||
|
||||
public sealed partial class AppModeFooterSwitcherControl : UserControl
|
||||
public sealed partial class AppModeFooterSwitcherControl : Segmented
|
||||
{
|
||||
private const double VerticalItemExtent = 44;
|
||||
private readonly IStatePersistanceService _statePersistenceService;
|
||||
private readonly INavigationService _navigationService;
|
||||
private bool _isUpdatingSelection;
|
||||
|
||||
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
|
||||
nameof(Orientation),
|
||||
typeof(Orientation),
|
||||
typeof(AppModeFooterSwitcherControl),
|
||||
new PropertyMetadata(Orientation.Horizontal, OnOrientationChanged));
|
||||
|
||||
public Orientation Orientation
|
||||
{
|
||||
get => (Orientation)GetValue(OrientationProperty);
|
||||
set => SetValue(OrientationProperty, value);
|
||||
}
|
||||
|
||||
public AppModeFooterSwitcherControl()
|
||||
{
|
||||
_statePersistenceService = WinoApplication.Current.Services.GetRequiredService<IStatePersistanceService>();
|
||||
@@ -22,9 +35,15 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private static void OnOrientationChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs _)
|
||||
{
|
||||
((AppModeFooterSwitcherControl)dependencyObject).UpdateOrientationState();
|
||||
}
|
||||
|
||||
private void ControlLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_statePersistenceService.StatePropertyChanged += StatePropertyChanged;
|
||||
UpdateOrientationState();
|
||||
UpdateSelection(_statePersistenceService.ApplicationMode);
|
||||
}
|
||||
|
||||
@@ -45,14 +64,14 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
|
||||
if (_isUpdatingSelection)
|
||||
return;
|
||||
|
||||
if (ModeSegmentedControl.SelectedIndex == 3)
|
||||
if (SelectedIndex == 3)
|
||||
{
|
||||
_navigationService.Navigate(WinoPage.SettingsPage);
|
||||
UpdateSelection(_statePersistenceService.ApplicationMode);
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedMode = ModeSegmentedControl.SelectedIndex switch
|
||||
var selectedMode = SelectedIndex switch
|
||||
{
|
||||
1 => WinoApplicationMode.Calendar,
|
||||
2 => WinoApplicationMode.Contacts,
|
||||
@@ -68,7 +87,7 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
|
||||
private void UpdateSelection(WinoApplicationMode mode)
|
||||
{
|
||||
_isUpdatingSelection = true;
|
||||
ModeSegmentedControl.SelectedIndex = mode switch
|
||||
SelectedIndex = mode switch
|
||||
{
|
||||
WinoApplicationMode.Calendar => 1,
|
||||
WinoApplicationMode.Contacts => 2,
|
||||
@@ -76,4 +95,24 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
|
||||
};
|
||||
_isUpdatingSelection = false;
|
||||
}
|
||||
|
||||
private void UpdateOrientationState()
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item is not SegmentedItem segmentedItem)
|
||||
continue;
|
||||
|
||||
if (Orientation == Orientation.Vertical)
|
||||
{
|
||||
segmentedItem.Width = VerticalItemExtent;
|
||||
segmentedItem.Height = VerticalItemExtent;
|
||||
}
|
||||
else
|
||||
{
|
||||
segmentedItem.ClearValue(WidthProperty);
|
||||
segmentedItem.ClearValue(HeightProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,10 +115,16 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView, IDisposable
|
||||
|
||||
private void UpdateActiveElements()
|
||||
{
|
||||
var itemsSource = GetItemsSource();
|
||||
|
||||
if (SelectedIndex < 0)
|
||||
{
|
||||
ActiveCanvas = null;
|
||||
ActiveVerticalScrollViewer = null;
|
||||
if (itemsSource == null || itemsSource.Count == 0)
|
||||
{
|
||||
ActiveCanvas = null;
|
||||
ActiveVerticalScrollViewer = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,9 +136,7 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView, IDisposable
|
||||
}
|
||||
else
|
||||
{
|
||||
// Container not ready yet - will be updated when OnContainerPrepared is called
|
||||
ActiveCanvas = null;
|
||||
ActiveVerticalScrollViewer = null;
|
||||
// Container not ready yet - keep the current active elements until OnContainerPrepared updates them.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"Wino.Mail.WinUI (Package)": {
|
||||
"commandName": "MsixPackage",
|
||||
"doNotLaunchApp": false,
|
||||
"nativeDebugging": false
|
||||
"nativeDebugging": true
|
||||
},
|
||||
"Wino.Mail.WinUI (Unpackaged)": {
|
||||
"commandName": "Project"
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
|
||||
xmlns:winoControls="using:Wino.Mail.WinUI.Controls">
|
||||
|
||||
<ItemsPanelTemplate x:Key="FooterAppModeSwitcherVerticalItemsPanelTemplate">
|
||||
<StackPanel Orientation="Vertical" />
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="CalendarShellNavigationViewStyle" TargetType="controls:NavigationView">
|
||||
<Setter Property="PaneToggleButtonStyle" Value="{StaticResource PaneToggleButtonStyle}" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
@@ -396,12 +400,13 @@
|
||||
VerticalContentAlignment="Stretch"
|
||||
IsTabStop="False" />
|
||||
<Border
|
||||
x:Name="FooterAppModeSwitcherBorder"
|
||||
Grid.Row="3"
|
||||
Margin="8,8,8,12"
|
||||
Padding="8"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
CornerRadius="{ThemeResource OverlayCornerRadius}">
|
||||
<winoControls:AppModeFooterSwitcherControl />
|
||||
<winoControls:AppModeFooterSwitcherControl x:Name="FooterAppModeSwitcher" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -525,6 +530,13 @@
|
||||
<Setter Target="PaneAutoSuggestBoxPresenter.Visibility" Value="Collapsed" />
|
||||
<Setter Target="PaneAutoSuggestButton.Visibility" Value="Visible" />
|
||||
<Setter Target="PaneCustomContentBorder.Visibility" Value="Collapsed" />
|
||||
<Setter Target="FooterAppModeSwitcher.ItemsPanel" Value="{StaticResource FooterAppModeSwitcherVerticalItemsPanelTemplate}" />
|
||||
<Setter Target="FooterAppModeSwitcher.Orientation" Value="Vertical" />
|
||||
<Setter Target="FooterAppModeSwitcherBorder.Margin" Value="0" />
|
||||
<Setter Target="FooterAppModeSwitcherBorder.Padding" Value="0" />
|
||||
<Setter Target="FooterAppModeSwitcherBorder.Background" Value="Transparent" />
|
||||
<Setter Target="FooterAppModeSwitcher.BorderThickness" Value="0" />
|
||||
<Setter Target="FooterAppModeSwitcher.Background" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||
xmlns:coreConverters="using:Wino.Mail.WinUI.Converters"
|
||||
xmlns:coreSelectors="using:Wino.Mail.WinUI.Selectors"
|
||||
xmlns:data="using:Wino.Calendar.ViewModels.Data"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:data="using:Wino.Calendar.ViewModels.Data"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:enums="using:Wino.Core.Domain.Enums"
|
||||
xmlns:helpers="using:Wino.Helpers"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:menu="using:Wino.Core.Domain.MenuItems"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
x:Name="Root"
|
||||
Loaded="OnLoaded"
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
x:Name="Root"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
@@ -425,8 +425,8 @@
|
||||
<ContentPresenter x:Name="DynamicPageShellContentPresenter" />
|
||||
<Grid
|
||||
x:Name="CalendarShellContentRoot"
|
||||
Visibility="Collapsed"
|
||||
ColumnSpacing="12">
|
||||
ColumnSpacing="12"
|
||||
Visibility="Collapsed">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -468,8 +468,7 @@
|
||||
Background="Transparent"
|
||||
FontSize="14"
|
||||
FontWeight="Normal"
|
||||
IsHitTestVisible="False"
|
||||
>
|
||||
IsHitTestVisible="False">
|
||||
<FlipView.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<TextBlock
|
||||
@@ -504,13 +503,11 @@
|
||||
Padding="0"
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0">
|
||||
|
||||
<muxc:NavigationView
|
||||
x:Name="navigationView"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="-1,-1,0,0"
|
||||
Style="{StaticResource CalendarShellNavigationViewStyle}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
AlwaysShowHeader="True"
|
||||
@@ -527,14 +524,18 @@
|
||||
PaneDisplayMode="Auto"
|
||||
PaneOpening="NavigationPaneOpening"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||
SelectionChanged="MenuSelectionChanged">
|
||||
SelectionChanged="MenuSelectionChanged"
|
||||
Style="{StaticResource CalendarShellNavigationViewStyle}">
|
||||
<muxc:NavigationView.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<AddDeleteThemeTransition />
|
||||
</TransitionCollection>
|
||||
</muxc:NavigationView.ContentTransitions>
|
||||
<muxc:NavigationView.PaneCustomContent>
|
||||
<Grid x:Name="PaneCustomContent" Padding="0,0,0,6" Visibility="Collapsed">
|
||||
<Grid
|
||||
x:Name="PaneCustomContent"
|
||||
Padding="0,0,0,6"
|
||||
Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -639,13 +640,13 @@
|
||||
IsHitTestVisible="{x:Bind navigationView.IsPaneOpen, Mode=OneWay}"
|
||||
IsTabStop="False"
|
||||
Maximum="1000"
|
||||
Minimum="116" />
|
||||
Minimum="160" />
|
||||
|
||||
<!-- Main Content -->
|
||||
<Frame
|
||||
x:Name="InnerShellFrame"
|
||||
CacheSize="0"
|
||||
Padding="0,0,7,7"
|
||||
CacheSize="0"
|
||||
IsNavigationStackEnabled="True"
|
||||
Navigated="ShellFrameContentNavigated">
|
||||
<Frame.ContentTransitions>
|
||||
|
||||
@@ -439,6 +439,16 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
|
||||
|
||||
private void CalendarClientPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (!DispatcherQueue.HasThreadAccess)
|
||||
{
|
||||
var enqueued = DispatcherQueue.TryEnqueue(() => CalendarClientPropertyChanged(sender, e));
|
||||
|
||||
if (!enqueued)
|
||||
throw new InvalidOperationException("Could not marshal calendar property changes onto the UI thread.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.PropertyName == nameof(ICalendarShellClient.DateNavigationHeaderItems))
|
||||
{
|
||||
DayHeaderNavigationItemsFlipView.ItemsSource = ViewModel.CalendarClient.DateNavigationHeaderItems;
|
||||
|
||||
Reference in New Issue
Block a user