navigation improvements

This commit is contained in:
Burak Kaan Köse
2026-03-14 14:14:58 +01:00
parent 4ba7d5fd07
commit 56b0f79edc
20 changed files with 605 additions and 153 deletions
+2
View File
@@ -722,6 +722,7 @@ public partial class App : WinoApplication,
public void Receive(AccountCreatedMessage message)
{
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
var navigationService = Services.GetRequiredService<INavigationService>();
// Only transition when the account was created from the WelcomeWindow.
if (windowManager.GetWindow(WinoWindowKind.Welcome) == null)
@@ -732,6 +733,7 @@ public partial class App : WinoApplication,
// Create and activate ShellWindow — ActiveWindowChanged fires and rebinds the dispatcher.
CreateWindow(null);
windowManager.HideWindow(WinoWindowKind.Welcome);
navigationService.ChangeApplicationMode(Core.Domain.Enums.WinoApplicationMode.Mail);
await NewThemeService.ApplyThemeToActiveWindowAsync();
MainWindow?.Activate();
RestartAutoSynchronizationLoop();
@@ -25,49 +25,62 @@
</Style>
</ContentDialog.Resources>
<ScrollViewer Margin="0,8,0,0">
<ItemsControl ItemsSource="{x:Bind AvailableGroups}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="calendar:CalendarPickerAccountGroup">
<StackPanel Margin="0,0,0,12" Spacing="6">
<TextBlock FontWeight="SemiBold">
<Run Text="{x:Bind Account.Name}" />
<Run Text=" (" />
<Run Text="{x:Bind Account.Address}" />
<Run Text=")" />
</TextBlock>
<StackPanel Margin="0,8,0,0" Spacing="12">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarHint, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
<ListView
IsItemClickEnabled="True"
ItemClick="CalendarClicked"
ItemContainerStyle="{StaticResource CalendarPickerListItemStyle}"
ItemsSource="{x:Bind Calendars}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="sharedCalendar:AccountCalendar">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<HyperlinkButton
HorizontalAlignment="Left"
Click="OpenCalendarSettingsClicked"
Content="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarSettingsLink, Mode=OneWay}"
Padding="0" />
<Ellipse
Width="14"
Height="14"
VerticalAlignment="Center"
Fill="{x:Bind helpers:XamlHelpers.GetSolidColorBrushFromHex(BackgroundColorHex), Mode=OneWay}" />
<ScrollViewer MaxHeight="400">
<ItemsControl ItemsSource="{x:Bind AvailableGroups}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="calendar:CalendarPickerAccountGroup">
<StackPanel Margin="0,0,0,12" Spacing="6">
<TextBlock FontWeight="SemiBold">
<Run Text="{x:Bind Account.Name}" />
<Run Text=" (" />
<Run Text="{x:Bind Account.Address}" />
<Run Text=")" />
</TextBlock>
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{x:Bind Name}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<ListView
IsItemClickEnabled="True"
ItemClick="CalendarClicked"
ItemContainerStyle="{StaticResource CalendarPickerListItemStyle}"
ItemsSource="{x:Bind Calendars}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="sharedCalendar:AccountCalendar">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Ellipse
Width="14"
Height="14"
VerticalAlignment="Center"
Fill="{x:Bind helpers:XamlHelpers.GetSolidColorBrushFromHex(BackgroundColorHex), Mode=OneWay}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{x:Bind Name}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</StackPanel>
</ContentDialog>
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Wino.Core.Domain.Entities.Calendar;
using Wino.Core.Domain.Models.Calendar;
@@ -8,6 +9,7 @@ namespace Wino.Dialogs;
public sealed partial class SingleCalendarPickerDialog : ContentDialog
{
public AccountCalendar? PickedCalendar { get; private set; }
public bool ShouldNavigateToCalendarSettings { get; private set; }
public List<CalendarPickerAccountGroup> AvailableGroups { get; } = [];
@@ -23,4 +25,10 @@ public sealed partial class SingleCalendarPickerDialog : ContentDialog
PickedCalendar = e.ClickedItem as AccountCalendar;
Hide();
}
private void OpenCalendarSettingsClicked(object sender, RoutedEventArgs e)
{
ShouldNavigateToCalendarSettings = true;
Hide();
}
}
+2 -2
View File
@@ -124,7 +124,7 @@ public class DialogService : DialogServiceBase, IMailDialogService
return accountPicker.PickedAccount ?? null!;
}
public async Task<AccountCalendar> ShowSingleCalendarPickerDialogAsync(List<CalendarPickerAccountGroup> availableCalendarGroups)
public async Task<AccountCalendarPickingResult> ShowSingleCalendarPickerDialogAsync(List<CalendarPickerAccountGroup> availableCalendarGroups)
{
var calendarPicker = new SingleCalendarPickerDialog(availableCalendarGroups)
{
@@ -133,7 +133,7 @@ public class DialogService : DialogServiceBase, IMailDialogService
await HandleDialogPresentationAsync(calendarPicker);
return calendarPicker.PickedCalendar ?? null!;
return new AccountCalendarPickingResult(calendarPicker.PickedCalendar, calendarPicker.ShouldNavigateToCalendarSettings);
}
public async Task<AccountSignature> ShowSignatureEditorDialog(AccountSignature? signatureModel = null)
+49 -8
View File
@@ -247,6 +247,8 @@ public class NavigationService : NavigationServiceBase, INavigationService
IsInitialActivation = isInitialShellNavigation,
Parameter = activationParameter
});
ResetCurrentModeBackStackState();
return true;
}
@@ -323,6 +325,7 @@ public class NavigationService : NavigationServiceBase, INavigationService
if (innerShellFrame.CanGoBack && lastBackStackEntry?.SourcePageType == pageType)
{
innerShellFrame.GoBack();
UpdateCurrentModeBackStackState(innerShellFrame);
WeakReferenceMessenger.Default.Send(loadCalendarMessage);
return true;
}
@@ -483,7 +486,14 @@ public class NavigationService : NavigationServiceBase, INavigationService
private bool NavigateInnerShellFrame(Frame frame, Type pageType, object? parameter, NavigationTransitionType transition)
{
var transitionInfo = ConsumeInnerShellTransitionOrDefault(transition);
return frame.Navigate(pageType, parameter, transitionInfo);
var navigationResult = frame.Navigate(pageType, parameter, transitionInfo);
if (navigationResult)
{
UpdateCurrentModeBackStackState(frame);
}
return navigationResult;
}
private NavigationTransitionInfo ConsumeInnerShellTransitionOrDefault(NavigationTransitionType transition)
@@ -503,36 +513,67 @@ public class NavigationService : NavigationServiceBase, INavigationService
private void GoBackInternal(Core.Domain.Enums.NavigationTransitionEffect slideEffect = Core.Domain.Enums.NavigationTransitionEffect.FromRight)
{
if (_statePersistanceService.IsSettingsNavigating)
var innerShellFrame = GetCoreFrameInternal(NavigationReferenceFrame.InnerShellFrame);
if (_statePersistanceService.ApplicationMode == WinoApplicationMode.Settings &&
_statePersistanceService.HasCurrentModeBackStack)
{
WeakReferenceMessenger.Default.Send(new BackBreadcrumNavigationRequested(slideEffect));
return;
}
var innerShellFrame = GetCoreFrameInternal(NavigationReferenceFrame.InnerShellFrame);
if (_statePersistanceService.ApplicationMode == WinoApplicationMode.Settings &&
innerShellFrame?.Content is SettingsPage)
{
return;
}
if (_statePersistanceService.ApplicationMode == WinoApplicationMode.Calendar && innerShellFrame?.CanGoBack == true)
{
innerShellFrame.GoBack();
UpdateCurrentModeBackStackState(innerShellFrame);
// Calendar mode: Navigate back from EventDetailsPage
_statePersistanceService.IsEventDetailsVisible = false;
}
else
else if (_statePersistanceService.ApplicationMode == WinoApplicationMode.Mail)
{
if (_statePersistanceService.IsReadingMail && _statePersistanceService.IsReaderNarrowed)
{
// Mail mode: Clear selections and dispose rendering frame
_statePersistanceService.IsReadingMail = false;
_statePersistanceService.HasCurrentModeBackStack = false;
WeakReferenceMessenger.Default.Send(new ClearMailSelectionsRequested());
WeakReferenceMessenger.Default.Send(new DisposeRenderingFrameRequested());
}
else if (innerShellFrame != null && innerShellFrame.CanGoBack)
{
innerShellFrame.GoBack();
}
}
else
{
UpdateCurrentModeBackStackState(innerShellFrame);
}
}
private void ResetCurrentModeBackStackState()
{
var innerShellFrame = GetCoreFrameInternal(NavigationReferenceFrame.InnerShellFrame);
if (innerShellFrame != null)
{
innerShellFrame.BackStack.Clear();
innerShellFrame.ForwardStack.Clear();
}
_statePersistanceService.HasCurrentModeBackStack = false;
}
private void UpdateCurrentModeBackStackState(Frame? innerShellFrame)
{
if (_statePersistanceService.ApplicationMode == WinoApplicationMode.Settings)
return;
_statePersistanceService.HasCurrentModeBackStack = _statePersistanceService.ApplicationMode == WinoApplicationMode.Calendar &&
innerShellFrame?.CanGoBack == true;
}
// Standalone EML viewer.
@@ -34,8 +34,8 @@ public class StatePersistenceService : ObservableObject, IStatePersistanceServic
public bool IsBackButtonVisible =>
ApplicationMode == WinoApplicationMode.Mail
? (IsReadingMail && IsReaderNarrowed) || IsSettingsNavigating
: IsEventDetailsVisible || IsSettingsNavigating;
? (IsReadingMail && IsReaderNarrowed) || HasCurrentModeBackStack
: IsEventDetailsVisible || HasCurrentModeBackStack;
private WinoApplicationMode applicationMode = WinoApplicationMode.Mail;
@@ -68,14 +68,14 @@ public class StatePersistenceService : ObservableObject, IStatePersistanceServic
}
}
private bool isSettingsNavigating;
private bool hasCurrentModeBackStack;
public bool IsSettingsNavigating
public bool HasCurrentModeBackStack
{
get => isSettingsNavigating;
get => hasCurrentModeBackStack;
set
{
if (SetProperty(ref isSettingsNavigating, value))
if (SetProperty(ref hasCurrentModeBackStack, value))
{
OnPropertyChanged(nameof(IsBackButtonVisible));
}
+41 -13
View File
@@ -64,23 +64,51 @@
<DataTemplate x:Key="SettingsShellSectionItemTemplate" x:DataType="menu:SettingsShellSectionMenuItem">
<coreControls:WinoNavigationViewItem
Margin="0,10,0,2"
HorizontalContentAlignment="Center"
Margin="0,12,0,4"
HorizontalContentAlignment="Stretch"
DataContext="{x:Bind}"
IsEnabled="False"
SelectsOnInvoked="False">
<muxc:NavigationViewItem.Icon>
<FontIcon
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="12"
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border
Width="24"
Height="24"
Background="{ThemeResource CardBackgroundFillColorSecondaryBrush}"
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="12">
<FontIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Glyph="{x:Bind Glyph}" />
</Border>
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
CharacterSpacing="40"
FontWeight="SemiBold"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Glyph="{x:Bind Glyph}" />
</muxc:NavigationViewItem.Icon>
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind Title}"
TextWrapping="NoWrap" />
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind Title}"
TextWrapping="NoWrap" />
<Border
Grid.Column="2"
Height="1"
Margin="2,0,0,0"
VerticalAlignment="Center"
Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
</Grid>
</coreControls:WinoNavigationViewItem>
</DataTemplate>
+157 -48
View File
@@ -3,43 +3,85 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:enums="using:Wino.Core.Domain.Enums"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settingsModels="using:Wino.Core.Domain.Models.Settings"
x:Name="root"
Title="{x:Bind domain:Translator.SettingsHome_Title}"
mc:Ignorable="d">
<ScrollViewer Padding="0,0,16,0" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0,8,0,24" Spacing="12">
<StackPanel Margin="0,8,0,24" Spacing="16">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition FromVerticalOffset="50" IsStaggeringEnabled="True" />
</TransitionCollection>
</StackPanel.ChildrenTransitions>
<Grid
Margin="0,0,0,12"
Padding="24,28"
<Border
Padding="24"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Spacing="8">
<AutoSuggestBox
x:Name="SettingsSearchBox"
ItemsSource="{x:Bind ViewModel.SearchSuggestions, Mode=OneWay}"
PlaceholderText="{x:Bind domain:Translator.SettingsHome_SearchPlaceholder, Mode=OneTime}"
QueryIcon="Find"
QuerySubmitted="SettingsSearchQuerySubmitted"
SuggestionChosen="SettingsSearchSuggestionChosen"
Text="{x:Bind ViewModel.SearchQuery, Mode=TwoWay}"
TextChanged="SettingsSearchTextChanged">
<AutoSuggestBox.ItemTemplate>
<DataTemplate x:DataType="settingsModels:SettingsNavigationItemInfo">
<Grid Padding="0,4" ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid
Grid.Column="1"
Margin="8,0,0,0"
VerticalAlignment="Center"
ColumnSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<FontIcon
VerticalAlignment="Top"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Glyph="{x:Bind Glyph}" />
<StackPanel Grid.Column="1" Spacing="2">
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="{x:Bind Title}" />
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind Description}"
TextWrapping="WrapWholeWords" />
</StackPanel>
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind domain:Translator.SettingsHome_SearchExamples, Mode=OneTime}"
TextWrapping="WrapWholeWords" />
</StackPanel>
</Border>
<Border
Padding="24,20"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8">
<Grid ColumnSpacing="16" RowSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel
VerticalAlignment="Center"
@@ -65,14 +107,11 @@
</StackPanel>
<StackPanel
Grid.RowSpan="2"
Grid.Column="2"
Margin="0,12,0,0"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="12">
<Button
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="{x:Bind ViewModel.PaypalUrl, Mode=OneWay}"
@@ -87,23 +126,19 @@
</Button>
<Button
Grid.Column="1"
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="{x:Bind ViewModel.GitHubUrl, Mode=OneWay}"
Style="{StaticResource DefaultButtonStyle}"
ToolTipService.ToolTip="{x:Bind domain:Translator.SettingsAboutGithub_Title}">
<StackPanel HorizontalAlignment="Center" Spacing="6">
<Viewbox Width="18" Height="18">
<Path
Data="m 12.2135 0 c -6.7538 0 -12.2135 5.5 -12.2135 12.3042 c 0 5.439 3.4983 10.043 8.3513 11.6725 c 0.6067 0.1225 0.829 -0.2647 0.829 -0.5905 c 0 -0.2853 -0.02 -1.263 -0.02 -2.2817 c -3.3975 0.7335 -4.105 -1.4668 -4.105 -1.4668 c -0.546 -1.426 -1.355 -1.7925 -1.355 -1.7925 c -1.112 -0.7538 0.081 -0.7538 0.081 -0.7538 c 1.2335 0.0815 1.8807 1.263 1.8807 1.263 c 1.0918 1.874 2.851 1.3445 3.5587 1.0185 c 0.101 -0.7945 0.4247 -1.3445 0.7685 -1.65 c -2.7097 -0.2853 -5.5607 -1.3445 -5.5607 -6.0708 c 0 -1.3445 0.485 -2.4445 1.2535 -3.3 c -0.1212 -0.3055 -0.546 -1.5687 0.1215 -3.2595 c 0 0 1.0313 -0.326 3.3565 1.263 a 11.7425 11.7425 90 0 1 3.0535 -0.4075 c 1.0313 0 2.0825 0.1428 3.0533 0.4075 c 2.3255 -1.589 3.3567 -1.263 3.3567 -1.263 c 0.6675 1.6908 0.2425 2.954 0.1212 3.2595 c 0.7888 0.8555 1.2538 1.9555 1.2538 3.3 c 0 4.7263 -2.851 5.765 -5.581 6.0708 c 0.445 0.387 0.829 1.1202 0.829 2.2815 c 0 1.65 -0.02 2.9743 -0.02 3.3815 c 0 0.326 0.2225 0.7132 0.829 0.591 c 4.853 -1.63 8.3513 -6.2338 8.3513 -11.6728 c 0.02 -6.8043 -5.4598 -12.3043 -12.1933 -12.3043 z"
Fill="{ThemeResource TextFillColorPrimaryBrush}"
Stretch="Uniform" />
</Viewbox>
</StackPanel>
<Viewbox Width="18" Height="18">
<Path
Data="m 12.2135 0 c -6.7538 0 -12.2135 5.5 -12.2135 12.3042 c 0 5.439 3.4983 10.043 8.3513 11.6725 c 0.6067 0.1225 0.829 -0.2647 0.829 -0.5905 c 0 -0.2853 -0.02 -1.263 -0.02 -2.2817 c -3.3975 0.7335 -4.105 -1.4668 -4.105 -1.4668 c -0.546 -1.426 -1.355 -1.7925 -1.355 -1.7925 c -1.112 -0.7538 0.081 -0.7538 0.081 -0.7538 c 1.2335 0.0815 1.8807 1.263 1.8807 1.263 c 1.0918 1.874 2.851 1.3445 3.5587 1.0185 c 0.101 -0.7945 0.4247 -1.3445 0.7685 -1.65 c -2.7097 -0.2853 -5.5607 -1.3445 -5.5607 -6.0708 c 0 -1.3445 0.485 -2.4445 1.2535 -3.3 c -0.1212 -0.3055 -0.546 -1.5687 0.1215 -3.2595 c 0 0 1.0313 -0.326 3.3565 1.263 a 11.7425 11.7425 90 0 1 3.0535 -0.4075 c 1.0313 0 2.0825 0.1428 3.0533 0.4075 c 2.3255 -1.589 3.3567 -1.263 3.3567 -1.263 c 0.6675 1.6908 0.2425 2.954 0.1212 3.2595 c 0.7888 0.8555 1.2538 1.9555 1.2538 3.3 c 0 4.7263 -2.851 5.765 -5.581 6.0708 c 0.445 0.387 0.829 1.1202 0.829 2.2815 c 0 1.65 -0.02 2.9743 -0.02 3.3815 c 0 0.326 0.2225 0.7132 0.829 0.591 c 4.853 -1.63 8.3513 -6.2338 8.3513 -11.6728 c 0.02 -6.8043 -5.4598 -12.3043 -12.1933 -12.3043 z"
Fill="{ThemeResource TextFillColorPrimaryBrush}"
Stretch="Uniform" />
</Viewbox>
</Button>
<Button
Grid.Column="2"
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="Store"
ToolTipService.ToolTip="{x:Bind domain:Translator.SettingsStore_Title}">
@@ -116,28 +151,102 @@
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>
<controls:SettingsCard
Margin="0,0,0,12"
Click="SettingOptionClicked"
Description="{x:Bind ViewModel.AccountSummaryText, Mode=OneWay}"
Header="{x:Bind domain:Translator.SettingsManageAccountSettings_Title}"
IsClickEnabled="True"
Tag="{x:Bind enums:WinoPage.ManageAccountsPage}">
<controls:SettingsCard.HeaderIcon>
<FontIcon Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}" Glyph="&#xE77B;" />
</controls:SettingsCard.HeaderIcon>
<StackPanel Spacing="12">
<Button
HorizontalContentAlignment="Stretch"
Click="SettingOptionClicked"
Style="{StaticResource AccentButtonStyle}"
Tag="{x:Bind enums:WinoPage.ManageAccountsPage}">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="{x:Bind domain:Translator.Buttons_Manage}" />
<FontIcon FontSize="12" Glyph="&#xE76C;" />
</StackPanel>
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<FontIcon
VerticalAlignment="Center"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Glyph="&#xE77B;" />
<StackPanel Grid.Column="1" Spacing="2">
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="{x:Bind domain:Translator.SettingsManageAccountSettings_Title, Mode=OneTime}" />
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.AccountSummaryText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</StackPanel>
<FontIcon
Grid.Column="2"
VerticalAlignment="Center"
Glyph="&#xE76C;" />
</Grid>
</Button>
</controls:SettingsCard>
<Button
HorizontalContentAlignment="Stretch"
Click="SettingOptionClicked"
Tag="{x:Bind enums:WinoPage.StoragePage}">
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<FontIcon
VerticalAlignment="Center"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Glyph="&#xE74C;" />
<StackPanel Grid.Column="1" Spacing="2">
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="{x:Bind domain:Translator.SettingsStorage_Title, Mode=OneTime}" />
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.StorageSummaryText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</StackPanel>
<FontIcon
Grid.Column="2"
VerticalAlignment="Center"
Glyph="&#xE76C;" />
</Grid>
</Button>
</StackPanel>
<Border
Padding="24"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8">
<StackPanel Spacing="10">
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="{x:Bind domain:Translator.SettingsHome_Resources_Title, Mode=OneTime}" />
<StackPanel Spacing="2">
<HyperlinkButton
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="{x:Bind ViewModel.WebsiteUrl, Mode=OneWay}"
Content="{x:Bind domain:Translator.SettingsWebsite_Title}" />
<HyperlinkButton
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="{x:Bind ViewModel.PrivacyPolicyUrl, Mode=OneWay}"
Content="{x:Bind domain:Translator.SettingsPrivacyPolicy_Title}" />
<HyperlinkButton
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="{x:Bind ViewModel.GitHubUrl, Mode=OneWay}"
Content="{x:Bind domain:Translator.SettingsAboutGithub_Title}" />
<HyperlinkButton
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="Store"
Content="{x:Bind domain:Translator.SettingsStore_Title}" />
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</abstract:SettingOptionsPageAbstract>
@@ -1,7 +1,7 @@
using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Settings;
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
@@ -18,7 +18,6 @@ public sealed partial class SettingOptionsPage : SettingOptionsPageAbstract
WinoPage? page = sender switch
{
Button button when button.Tag is WinoPage p => p,
SettingsCard card when card.Tag is WinoPage p => p,
_ => null
};
@@ -27,4 +26,28 @@ public sealed partial class SettingOptionsPage : SettingOptionsPageAbstract
ViewModel.NavigateSubDetailCommand.Execute(page.Value);
}
}
private void SettingsSearchTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput || string.IsNullOrWhiteSpace(sender.Text))
{
ViewModel.UpdateSearchSuggestions(sender.Text);
}
}
private void SettingsSearchSuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
{
if (args.SelectedItem is SettingsNavigationItemInfo selectedSetting)
{
ViewModel.SearchQuery = selectedSetting.Title;
}
}
private void SettingsSearchQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
var selectedSetting = args.ChosenSuggestion as SettingsNavigationItemInfo
?? ViewModel.GetBestSearchSuggestion(args.QueryText);
ViewModel.NavigateToSetting(selectedSetting);
}
}
+16 -2
View File
@@ -71,7 +71,7 @@ public sealed partial class SettingsPage : SettingsPageAbstract,
SettingsFrame.Navigated -= SettingsFrameNavigated;
// Reset navigation state when leaving SettingsPage
ViewModel.StatePersistenceService.IsSettingsNavigating = false;
ViewModel.StatePersistenceService.HasCurrentModeBackStack = false;
base.OnNavigatingFrom(e);
}
@@ -202,9 +202,23 @@ public sealed partial class SettingsPage : SettingsPageAbstract,
UpdateWindowTitle();
}
public void ResetForModeSwitch()
{
while (PageHistory.Count > 1 && SettingsFrame.CanGoBack)
{
if (!BreadcrumbNavigationHelper.GoBack(SettingsFrame, PageHistory, Core.Domain.Enums.NavigationTransitionEffect.FromRight))
break;
}
SettingsFrame.ForwardStack.Clear();
UpdateBackNavigationState();
_ = RefreshCurrentPageStateAsync();
UpdateWindowTitle();
}
private void UpdateBackNavigationState()
{
ViewModel.StatePersistenceService.IsSettingsNavigating = PageHistory.Count > 1 && SettingsFrame.CanGoBack;
ViewModel.StatePersistenceService.HasCurrentModeBackStack = PageHistory.Count > 1 && SettingsFrame.CanGoBack;
}
private async Task RefreshCurrentPageStateAsync()
+21 -2
View File
@@ -33,6 +33,7 @@ using Wino.Messaging.Client.Accounts;
using Wino.Messaging.Client.Calendar;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Messaging.UI;
using Wino.Views.Mail;
using Wino.Views;
using Wino.Views.Settings;
@@ -45,7 +46,8 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
IRecipient<AccountMenuItemExtended>,
IRecipient<NavigateMailFolderEvent>,
IRecipient<CreateNewMailWithMultipleAccountsRequested>,
IRecipient<CalendarDisplayTypeChangedMessage>
IRecipient<CalendarDisplayTypeChangedMessage>,
IRecipient<AccountCreatedMessage>
{
private const string StateHorizontalCalendar = "HorizontalCalendar";
private const string StateVerticalCalendar = "VerticalCalendar";
@@ -97,6 +99,7 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
UpdateTitleBarSubtitle();
ViewModel.CurrentClient.Activate(activationContext);
ResetShellModeNavigationState();
ApplyTitleBarContent();
}
@@ -158,6 +161,11 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
}
else if (_activeMode == WinoApplicationMode.Settings)
{
if (InnerShellFrame.Content is SettingsPage settingsPage)
{
settingsPage.ResetForModeSwitch();
}
ViewModel.CurrentClient.Deactivate();
}
@@ -166,7 +174,7 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
private void ResetShellModeNavigationState()
{
ViewModel.StatePersistenceService.IsSettingsNavigating = false;
ViewModel.StatePersistenceService.HasCurrentModeBackStack = false;
InnerShellFrame.BackStack.Clear();
InnerShellFrame.ForwardStack.Clear();
}
@@ -284,6 +292,15 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
public void Receive(CalendarDisplayTypeChangedMessage message) => ManageCalendarDisplayType(message.NewDisplayType);
public void Receive(AccountCreatedMessage message)
{
_ = DispatcherQueue.EnqueueAsync(async () =>
{
ViewModel.NavigationService.ChangeApplicationMode(WinoApplicationMode.Mail);
await ViewModel.MailClient.HandleAccountCreatedAsync(message.Account);
});
}
private async void NavigationViewItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
if (_isSyncingNavigationViewSelection)
@@ -758,6 +775,7 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
WeakReferenceMessenger.Default.Register<CreateNewMailWithMultipleAccountsRequested>(this);
WeakReferenceMessenger.Default.Register<NavigateMailFolderEvent>(this);
WeakReferenceMessenger.Default.Register<CalendarDisplayTypeChangedMessage>(this);
WeakReferenceMessenger.Default.Register<AccountCreatedMessage>(this);
}
protected override void UnregisterRecipients()
@@ -768,5 +786,6 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
WeakReferenceMessenger.Default.Unregister<CreateNewMailWithMultipleAccountsRequested>(this);
WeakReferenceMessenger.Default.Unregister<NavigateMailFolderEvent>(this);
WeakReferenceMessenger.Default.Unregister<CalendarDisplayTypeChangedMessage>(this);
WeakReferenceMessenger.Default.Unregister<AccountCreatedMessage>(this);
}
}