Import functionality for wino accounts, calendar sync UI, bunch of shell improvements
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
<ContentDialog
|
||||
x:Class="Wino.Dialogs.WhatIsNewDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Wino.Mail.WinUI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
Style="{StaticResource WinoDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ContentDialog.Resources>
|
||||
<x:Double x:Key="ContentDialogMinWidth">480</x:Double>
|
||||
<x:Double x:Key="ContentDialogMaxWidth">560</x:Double>
|
||||
<x:Double x:Key="ContentDialogMinHeight">480</x:Double>
|
||||
<x:Double x:Key="ContentDialogMaxHeight">700</x:Double>
|
||||
</ContentDialog.Resources>
|
||||
|
||||
<Grid RowSpacing="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<controls:UpdateNotesFlipViewControl x:Name="UpdateNotesControl" Sections="{x:Bind Sections, Mode=OneTime}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Button
|
||||
x:Name="GetStartedButton"
|
||||
Click="OnGetStartedClicked"
|
||||
Content="{x:Bind domain:Translator.WhatIsNew_GetStartedButton}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Visibility="Collapsed" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ContentDialog>
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Dialogs;
|
||||
|
||||
public sealed partial class WhatIsNewDialog : ContentDialog
|
||||
{
|
||||
private readonly IUpdateManager _updateManager;
|
||||
|
||||
public List<UpdateNoteSection> Sections { get; }
|
||||
|
||||
private bool _canClose = false;
|
||||
|
||||
public WhatIsNewDialog(UpdateNotes notes, IUpdateManager updateManager)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_updateManager = updateManager;
|
||||
Sections = notes.Sections;
|
||||
|
||||
// Show the Get Started button immediately when there is only one page.
|
||||
UpdateNotesControl.SelectedIndexChanged += OnUpdateSectionChanged;
|
||||
UpdateGetStartedButtonVisibility(UpdateNotesControl.SelectedIndex);
|
||||
Closing += OnDialogClosing;
|
||||
}
|
||||
|
||||
private void OnUpdateSectionChanged(object? sender, int selectedIndex)
|
||||
=> UpdateGetStartedButtonVisibility(selectedIndex);
|
||||
|
||||
private void UpdateGetStartedButtonVisibility(int selectedIndex)
|
||||
{
|
||||
GetStartedButton.Visibility = selectedIndex == Sections.Count - 1
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void OnDialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
|
||||
{
|
||||
// Only allow closing when Get Started button was clicked.
|
||||
if (!_canClose)
|
||||
args.Cancel = true;
|
||||
}
|
||||
|
||||
private void OnGetStartedClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GetStartedButton.IsEnabled = false;
|
||||
_updateManager.MarkUpdateNotesAsSeen();
|
||||
_canClose = true;
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<ContentDialog
|
||||
x:Class="Wino.Dialogs.WinoAccountSyncExportDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonClick="ExportClicked"
|
||||
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}"
|
||||
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Export, Mode=OneTime}"
|
||||
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Close, Mode=OneTime}"
|
||||
Style="{StaticResource WinoDialogStyle}"
|
||||
Title="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_Title, Mode=OneTime}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ContentDialog.Resources>
|
||||
<x:Double x:Key="ContentDialogMinWidth">520</x:Double>
|
||||
<x:Double x:Key="ContentDialogMaxWidth">520</x:Double>
|
||||
</ContentDialog.Resources>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Spacing="16">
|
||||
<TextBlock
|
||||
Text="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_Description, Mode=OneTime}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
|
||||
<StackPanel Spacing="12">
|
||||
<CheckBox
|
||||
x:Name="PreferencesCheckBox"
|
||||
Checked="SelectionChanged"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_IncludePreferences, Mode=OneTime}"
|
||||
IsChecked="True"
|
||||
Unchecked="SelectionChanged" />
|
||||
|
||||
<StackPanel Spacing="8">
|
||||
<CheckBox
|
||||
x:Name="AccountsCheckBox"
|
||||
Checked="SelectionChanged"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_IncludeAccounts, Mode=OneTime}"
|
||||
IsChecked="True"
|
||||
Unchecked="SelectionChanged" />
|
||||
|
||||
<Border
|
||||
Padding="12"
|
||||
Background="{ThemeResource CardBackgroundFillColorSecondaryBrush}"
|
||||
CornerRadius="10">
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock
|
||||
Style="{StaticResource BodyStrongTextBlockStyle}"
|
||||
Text="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_AccountsDisclaimer, Mode=OneTime}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_AccountsRelogin, Mode=OneTime}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
x:Name="ProgressPanel"
|
||||
Spacing="8"
|
||||
Visibility="Collapsed">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind domain:Translator.WinoAccount_Management_ExportDialog_InProgress, Mode=OneTime}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
<ProgressBar IsIndeterminate="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ContentDialog>
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
|
||||
namespace Wino.Dialogs;
|
||||
|
||||
public sealed partial class WinoAccountSyncExportDialog : ContentDialog
|
||||
{
|
||||
private readonly IWinoAccountDataSyncService _syncService;
|
||||
private bool _isBusy;
|
||||
|
||||
public WinoAccountSyncExportDialog(IWinoAccountDataSyncService syncService)
|
||||
{
|
||||
_syncService = syncService;
|
||||
InitializeComponent();
|
||||
UpdateButtonState();
|
||||
}
|
||||
|
||||
public WinoAccountSyncExportResult? Result { get; private set; }
|
||||
|
||||
public Exception? FailureException { get; private set; }
|
||||
|
||||
private async void ExportClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
args.Cancel = true;
|
||||
|
||||
if (!HasSelection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var deferral = args.GetDeferral();
|
||||
|
||||
try
|
||||
{
|
||||
SetBusyState(true);
|
||||
FailureException = null;
|
||||
Result = await _syncService.ExportAsync(new WinoAccountSyncSelection(
|
||||
PreferencesCheckBox.IsChecked == true,
|
||||
AccountsCheckBox.IsChecked == true));
|
||||
Hide();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FailureException = ex;
|
||||
Hide();
|
||||
}
|
||||
finally
|
||||
{
|
||||
SetBusyState(false);
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectionChanged(object sender, RoutedEventArgs e)
|
||||
=> UpdateButtonState();
|
||||
|
||||
private void SetBusyState(bool isBusy)
|
||||
{
|
||||
_isBusy = isBusy;
|
||||
ProgressPanel.Visibility = isBusy ? Visibility.Visible : Visibility.Collapsed;
|
||||
IsSecondaryButtonEnabled = !isBusy;
|
||||
UpdateButtonState();
|
||||
}
|
||||
|
||||
private void UpdateButtonState()
|
||||
=> IsPrimaryButtonEnabled = !_isBusy && HasSelection();
|
||||
|
||||
private bool HasSelection()
|
||||
=> PreferencesCheckBox.IsChecked == true || AccountsCheckBox.IsChecked == true;
|
||||
}
|
||||
Reference in New Issue
Block a user