I don't know some changes....

This commit is contained in:
Burak Kaan Köse
2024-07-19 20:31:13 +02:00
parent 026151e7e4
commit 5b68f237f0
384 changed files with 176 additions and 29755 deletions

View File

@@ -1,59 +0,0 @@
<dialogs:BaseAccountCreationDialog
xmlns:dialogs="using:Wino.Dialogs"
x:Class="Wino.Dialogs.AccountCreationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.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"
x:Name="Root"
CornerRadius="8"
mc:Ignorable="d">
<Grid x:Name="RootGrid" RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Viewbox Width="24">
<PathIcon x:Name="DialogIcon" />
</Viewbox>
<muxc:ProgressBar Grid.Row="1" IsIndeterminate="True" />
<TextBlock
x:Name="StatusText"
Grid.Row="2"
HorizontalAlignment="Center"
Text="{x:Bind domain:Translator.AccountCreationDialog_Initializing}"
TextWrapping="Wrap" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DialogStates">
<VisualState x:Name="PreparingFolders">
<VisualState.Setters>
<Setter Target="StatusText.Text" Value="{x:Bind domain:Translator.AccountCreationDialog_PreparingFolders}" />
<Setter Target="DialogIcon.Data" Value="M1024,317.5L1024,507C1014.67,495.333 1004.67,484.167 994,473.5C983.333,462.833 972,453 960,444L960,320C960,311.333 958.333,303.083 955,295.25C951.667,287.417 947.083,280.583 941.25,274.75C935.417,268.917 928.583,264.333 920.75,261C912.917,257.667 904.667,256 896,256L522,256L458,298.5C436,312.833 412.333,320 387,320L64,320L64,832C64,841 65.6667,849.417 69,857.25C72.3333,865.083 76.8333,871.833 82.5,877.5C88.1667,883.167 94.9167,887.667 102.75,891C110.583,894.333 119,896 128,896L404.5,896C410.167,907.333 416.25,918.333 422.75,929C429.25,939.667 436.333,950 444,960L125.5,960C108.833,960 92.9167,956.583 77.75,949.75C62.5833,942.917 49.25,933.75 37.75,922.25C26.25,910.75 17.0833,897.417 10.25,882.25C3.41667,867.083 0,851.167 0,834.5L0,189.5C0,172.833 3.41667,156.917 10.25,141.75C17.0833,126.583 26.25,113.25 37.75,101.75C49.25,90.25 62.5833,81.0834 77.75,74.25C92.9167,67.4167 108.833,64.0001 125.5,64L368,64C388,64.0001 407.167,68.5001 425.5,77.5C443.833,86.5001 458.833,99.0001 470.5,115L528,192L898.5,192C915.167,192 931.083,195.417 946.25,202.25C961.417,209.083 974.75,218.25 986.25,229.75C997.75,241.25 1006.92,254.583 1013.75,269.75C1020.58,284.917 1024,300.833 1024,317.5ZM466,216L419,153.5C413,145.5 405.5,139.25 396.5,134.75C387.5,130.25 378,128 368,128L128,128C119,128 110.667,129.667 103,133C95.3333,136.333 88.5833,140.917 82.75,146.75C76.9167,152.583 72.3333,159.333 69,167C65.6667,174.667 64,183 64,192L64,256L387,256C394.333,256 401.5,254.667 408.5,252C415.5,249.333 422.25,246 428.75,242C435.25,238 441.583,233.667 447.75,229C453.917,224.333 460,220 466,216ZM1024,736C1024,775.667 1016.42,813 1001.25,848C986.083,883 965.5,913.5 939.5,939.5C913.5,965.5 883,986.083 848,1001.25C813,1016.42 775.667,1024 736,1024C696,1024 658.5,1016.5 623.5,1001.5C588.5,986.5 558,966 532,940C506,914 485.5,883.5 470.5,848.5C455.5,813.5 448,776 448,736C448,696.333 455.583,659 470.75,624C485.917,589 506.5,558.5 532.5,532.5C558.5,506.5 589,485.917 624,470.75C659,455.583 696.333,448 736,448C762.333,448 787.75,451.417 812.25,458.25C836.75,465.083 859.667,474.75 881,487.25C902.333,499.75 921.833,514.833 939.5,532.5C957.167,550.167 972.25,569.667 984.75,591C997.25,612.333 1006.92,635.25 1013.75,659.75C1020.58,684.25 1024,709.667 1024,736ZM896,576C896,567.333 892.833,559.833 886.5,553.5C880.167,547.167 872.667,544 864,544C857.667,544 852.5,545.167 848.5,547.5C844.5,549.833 841.25,552.917 838.75,556.75C836.25,560.583 834.5,565 833.5,570C832.5,575 832,580.167 832,585.5C816.333,577.167 800.917,570.833 785.75,566.5C770.583,562.167 754,560 736,560C724,560 711.75,561.25 699.25,563.75C686.75,566.25 674.5,569.917 662.5,574.75C650.5,579.583 639.083,585.417 628.25,592.25C617.417,599.083 608,607 600,616C597,619.333 594.667,622.75 593,626.25C591.333,629.75 590.5,633.833 590.5,638.5C590.5,647.5 593.667,655.167 600,661.5C606.333,667.833 614,671 623,671C628.667,671 634.75,668.583 641.25,663.75C647.75,658.917 655.333,653.5 664,647.5C672.667,641.5 682.75,636.083 694.25,631.25C705.75,626.417 719.333,624 735,624C746.667,624 757.5,625.25 767.5,627.75C777.5,630.25 787.667,634.333 798,640L785,640C779,640 773.083,640.25 767.25,640.75C761.417,641.25 756.167,642.583 751.5,644.75C746.833,646.917 743.083,650.167 740.25,654.5C737.417,658.833 736,664.667 736,672C736,680.667 739.167,688.167 745.5,694.5C751.833,700.833 759.333,704 768,704L864,704C872.667,704 880.167,700.833 886.5,694.5C892.833,688.167 896,680.667 896,672ZM881.5,833C881.5,824.333 878.333,816.833 872,810.5C865.667,804.167 858.167,801 849.5,801C842.833,801 836.333,803.417 830,808.25C823.667,813.083 816.333,818.5 808,824.5C799.667,830.5 789.833,835.917 778.5,840.75C767.167,845.583 753.333,848 737,848C725.333,848 714.5,846.75 704.5,844.25C694.5,841.75 684.333,837.667 674,832L687,832C692.667,832 698.417,831.75 704.25,831.25C710.083,830.75 715.333,829.417 720,827.25C724.667,825.083 728.5,821.833 731.5,817.5C734.5,813.167 736,807.333 736,800C736,791.333 732.833,783.833 726.5,777.5C720.167,771.167 712.667,768 704,768L608,768C599.333,768 591.833,771.167 585.5,777.5C579.167,783.833 576,791.333 576,800L576,896C576,904.667 579.167,912.167 585.5,918.5C591.833,924.833 599.333,928 608,928C614.333,928 619.5,926.833 623.5,924.5C627.5,922.167 630.75,919.083 633.25,915.25C635.75,911.417 637.5,907 638.5,902C639.5,897 640,891.833 640,886.5C655.667,894.833 671.083,901.167 686.25,905.5C701.417,909.833 718,912 736,912C748,912 760.333,910.75 773,908.25C785.667,905.75 797.917,902.083 809.75,897.25C821.583,892.417 832.833,886.583 843.5,879.75C854.167,872.917 863.667,865 872,856C878.333,849.333 881.5,841.667 881.5,833Z" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="SigningIn">
<VisualState.Setters>
<Setter Target="StatusText.Text" Value="{x:Bind domain:Translator.AccountCreationDialog_SigninIn}" />
<Setter Target="DialogIcon.Glyph" Value="M128,220C128,190 134.083,161.667 146.25,135C158.417,108.333 174.75,85 195.25,65C215.75,45 239.5,29.1667 266.5,17.5C293.5,5.83337 322,0 352,0C382.667,0 411.583,5.91669 438.75,17.75C465.917,29.5834 489.667,45.6667 510,66C530.333,86.3334 546.417,110.083 558.25,137.25C570.083,164.417 576,193.333 576,224C576,254.667 570.083,283.583 558.25,310.75C546.417,337.917 530.333,361.667 510,382C489.667,402.333 465.917,418.417 438.75,430.25C411.583,442.083 382.667,448 352,448C320.333,448 290.833,442 263.5,430C236.167,418 212.5,401.667 192.5,381C172.5,360.333 156.75,336.167 145.25,308.5C133.75,280.833 128,251.333 128,220ZM512,220.5C512,198.833 507.667,178.5 499,159.5C490.333,140.5 478.667,123.917 464,109.75C449.333,95.5834 432.333,84.4167 413,76.25C393.667,68.0834 373.333,64.0001 352,64C329.667,64.0001 308.833,68.1667 289.5,76.5C270.167,84.8334 253.25,96.25 238.75,110.75C224.25,125.25 212.833,142.167 204.5,161.5C196.167,180.833 192,201.667 192,224C192,246.333 196.167,267.167 204.5,286.5C212.833,305.833 224.25,322.75 238.75,337.25C253.25,351.75 270.167,363.167 289.5,371.5C308.833,379.833 329.667,384 352,384C375,384 396.25,379.75 415.75,371.25C435.25,362.75 452.167,351.083 466.5,336.25C480.833,321.417 492,304.083 500,284.25C508,264.417 512,243.167 512,220.5ZM640,284.5C640,262.833 644.333,242.5 653,223.5C661.667,204.5 673.333,187.917 688,173.75C702.667,159.583 719.667,148.417 739,140.25C758.333,132.083 778.667,128 800,128C822.333,128 843.167,132.167 862.5,140.5C881.833,148.833 898.75,160.25 913.25,174.75C927.75,189.25 939.167,206.167 947.5,225.5C955.833,244.833 960,265.667 960,288C960,310.333 955.833,331.167 947.5,350.5C939.167,369.833 927.75,386.75 913.25,401.25C898.75,415.75 881.833,427.167 862.5,435.5C843.167,443.833 822.333,448 800,448C777,448 755.75,443.75 736.25,435.25C716.75,426.75 699.833,415.083 685.5,400.25C671.167,385.417 660,368.083 652,348.25C644,328.417 640,307.167 640,284.5ZM896,288C896,275 893.5,262.667 888.5,251C883.5,239.333 876.583,229.083 867.75,220.25C858.917,211.417 848.667,204.5 837,199.5C825.333,194.5 813,192 800,192C787,192 774.667,194.5 763,199.5C751.333,204.5 741.083,211.417 732.25,220.25C723.417,229.083 716.5,239.333 711.5,251C706.5,262.667 704,275 704,288C704,301 706.5,313.333 711.5,325C716.5,336.667 723.417,346.917 732.25,355.75C741.083,364.583 751.333,371.5 763,376.5C774.667,381.5 787,384 800,384C813,384 825.333,381.5 837,376.5C848.667,371.5 858.917,364.583 867.75,355.75C876.583,346.917 883.5,336.667 888.5,325C893.5,313.333 896,301 896,288ZM0,638C0,623.667 2.41667,609 7.25,594C12.0833,579 19,565.417 28,553.25C37,541.083 47.9167,531.167 60.75,523.5C73.5833,515.833 88,512 104,512L600,512C616,512 630.417,515.833 643.25,523.5C656.083,531.167 667,541.083 676,553.25C685,565.417 691.917,579 696.75,594C701.583,609 704,623.667 704,638C704,667 701,694.917 695,721.75C689,748.583 679.75,773.833 667.25,797.5C654.75,821.167 639.083,842.917 620.25,862.75C601.417,882.583 579.167,899.833 553.5,914.5C538.5,923.167 522.75,930.417 506.25,936.25C489.75,942.083 473,946.75 456,950.25C439,953.75 421.75,956.25 404.25,957.75C386.75,959.25 369.333,960 352,960C317,960 282.333,956.833 248,950.5C213.667,944.167 181.167,932.167 150.5,914.5C124.5,899.5 102.083,882.167 83.25,862.5C64.4167,842.833 48.8333,821.25 36.5,797.75C24.1667,774.25 15,749.083 9,722.25C3,695.417 0,667.333 0,638ZM698.5,896C714.833,876.333 728.833,854.5 740.5,830.5C771.5,828.167 800.417,822.417 827.25,813.25C854.083,804.083 877.333,791.083 897,774.25C916.667,757.417 932.083,736.583 943.25,711.75C954.417,686.917 960,657.667 960,624C960,619 959.25,613.75 957.75,608.25C956.25,602.75 954.083,597.583 951.25,592.75C948.417,587.917 944.833,583.917 940.5,580.75C936.167,577.583 931.167,576 925.5,576L775,576C771.333,564.667 767,553.583 762,542.75C757,531.917 751.167,521.667 744.5,512L925.5,512C940.167,512 953.583,515.25 965.75,521.75C977.917,528.25 988.333,536.75 997,547.25C1005.67,557.75 1012.33,569.75 1017,583.25C1021.67,596.75 1024,610.333 1024,624C1024,675.333 1012.5,720.833 989.5,760.5C966.5,800.167 932.333,832.333 887,857C858.333,872.667 827.833,883.083 795.5,888.25C763.167,893.417 730.833,896 698.5,896ZM640,640C640,634.333 639.167,627.75 637.5,620.25C635.833,612.75 633.25,605.75 629.75,599.25C626.25,592.75 621.833,587.25 616.5,582.75C611.167,578.25 605,576 598,576L106,576C99,576 92.8333,578.25 87.5,582.75C82.1667,587.25 77.75,592.75 74.25,599.25C70.75,605.75 68.1667,612.75 66.5,620.25C64.8333,627.75 64,634.333 64,640C64,684.333 71.25,722.583 85.75,754.75C100.25,786.917 120.333,813.5 146,834.5C171.667,855.5 202.083,871 237.25,881C272.417,891 310.667,896 352,896C393.333,896 431.583,891 466.75,881C501.917,871 532.333,855.5 558,834.5C583.667,813.5 603.75,786.917 618.25,754.75C632.75,722.583 640,684.333 640,640Z" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Completed">
<VisualState.Setters>
<Setter Target="StatusText.Text" Value="{x:Bind domain:Translator.AccountCreationDialog_Completed}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Idle" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</dialogs:BaseAccountCreationDialog>

View File

@@ -1,33 +0,0 @@
using Wino.Core.Domain.Enums;
using Wino.Helpers;
namespace Wino.Dialogs
{
public sealed partial class AccountCreationDialog : BaseAccountCreationDialog
{
public AccountCreationDialog()
{
InitializeComponent();
}
public override void UpdateState()
{
switch (State)
{
case AccountCreationDialogState.SigningIn:
StatusText.Text = "Account information is being saved.";
DialogIcon.Data = XamlHelpers.GetPathIcon("SavingAccountPathIcon");
break;
case AccountCreationDialogState.PreparingFolders:
StatusText.Text = "We are getting folder information at the moment.";
DialogIcon.Data = XamlHelpers.GetPathIcon("PreparingFoldersPathIcon");
break;
case AccountCreationDialogState.Completed:
StatusText.Text = "All done.";
break;
default:
break;
}
}
}
}

View File

@@ -1,19 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.AccountEditDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:domain="using:Wino.Core.Domain"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="{x:Bind domain:Translator.AccountEditDialog_Title}"
Style="{StaticResource WinoDialogStyle}"
DefaultButton="Primary"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Save}"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Discard}"
PrimaryButtonClick="SaveClicked">
<Grid>
<TextBox Text="{x:Bind Account.Name, Mode=TwoWay}" Header="{x:Bind domain:Translator.AccountEditDialog_Message}" />
</Grid>
</ContentDialog>

View File

@@ -1,27 +0,0 @@
using Wino.Core.Domain.Entities;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class AccountEditDialog : ContentDialog
{
public MailAccount Account { get; private set; }
public bool IsSaved { get; set; }
public AccountEditDialog(MailAccount account)
{
InitializeComponent();
Account = account;
}
private void SaveClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
IsSaved = true;
}
}
}

View File

@@ -1,19 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.AccountPickerDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Style="{StaticResource WinoDialogStyle}"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
xmlns:domain="using:Wino.Core.Domain"
Title="{x:Bind domain:Translator.AccountPickerDialog_Title}">
<ListView
ItemsSource="{x:Bind AvailableAccounts}"
IsItemClickEnabled="True"
DisplayMemberPath="Address"
SelectionMode="None"
ItemClick="AccountClicked" />
</ContentDialog>

View File

@@ -1,32 +0,0 @@
using System.Collections.Generic;
using Wino.Core.Domain.Entities;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class AccountPickerDialog : ContentDialog
{
public MailAccount PickedAccount { get; set; }
public List<MailAccount> AvailableAccounts { get; set; }
public AccountPickerDialog(List<MailAccount> availableAccounts)
{
AvailableAccounts = availableAccounts;
InitializeComponent();
}
private void AccountClicked(object sender, ItemClickEventArgs e)
{
PickedAccount = e.ClickedItem as MailAccount;
Hide();
}
}
}

View File

@@ -1,84 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.AccountReorderDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Wino.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:interfaces="using:Wino.Core.Domain.Interfaces"
xmlns:controls="using:Wino.Controls"
xmlns:helpers="using:Wino.Helpers"
xmlns:domain="using:Wino.Core.Domain"
xmlns:selectors="using:Wino.Selectors"
mc:Ignorable="d"
Title="Reorder Accounnts"
Closed="DialogClosed"
Opened="DialogOpened"
DefaultButton="Secondary"
Style="{StaticResource WinoDialogStyle}"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}">
<ContentDialog.Resources>
<DataTemplate x:Key="RootAccountReorderTemplate" x:DataType="interfaces:IAccountProviderDetailViewModel">
<Grid Padding="12" ColumnSpacing="24">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<controls:WinoFontIcon
Icon="{x:Bind helpers:XamlHelpers.GetProviderIcon(ProviderDetail.Type)}"
FontSize="24"
Grid.RowSpan="2"
VerticalAlignment="Center" />
<TextBlock
Text="{x:Bind StartupEntityTitle}"
Grid.Column="1"
FontWeight="SemiBold" />
<TextBlock
Text="{x:Bind StartupEntityAddresses}"
Grid.Column="1"
Grid.Row="1" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="MergedAccountReorderTemplate" x:DataType="interfaces:IAccountProviderDetailViewModel">
<Grid Padding="12" ColumnSpacing="24">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<PathIcon
Grid.RowSpan="2"
VerticalAlignment="Center"
Data="F1 M 8.613281 17.5 C 8.75 17.942709 8.945312 18.359375 9.199219 18.75 L 4.921875 18.75 C 4.433594 18.75 3.966471 18.650717 3.520508 18.452148 C 3.074544 18.25358 2.683919 17.986654 2.348633 17.651367 C 2.013346 17.31608 1.746419 16.925455 1.547852 16.479492 C 1.349284 16.033529 1.25 15.566406 1.25 15.078125 L 1.25 4.921875 C 1.25 4.433594 1.349284 3.966473 1.547852 3.520508 C 1.746419 3.074545 2.013346 2.68392 2.348633 2.348633 C 2.683919 2.013348 3.074544 1.74642 3.520508 1.547852 C 3.966471 1.349285 4.433594 1.25 4.921875 1.25 L 15.078125 1.25 C 15.566406 1.25 16.033527 1.349285 16.479492 1.547852 C 16.925455 1.74642 17.31608 2.013348 17.651367 2.348633 C 17.986652 2.68392 18.25358 3.074545 18.452148 3.520508 C 18.650715 3.966473 18.75 4.433594 18.75 4.921875 L 18.75 6.572266 C 18.580729 6.344402 18.390299 6.132813 18.178711 5.9375 C 17.967121 5.742188 17.740885 5.566407 17.5 5.410156 L 17.5 4.951172 C 17.5 4.625651 17.433268 4.314779 17.299805 4.018555 C 17.16634 3.722332 16.987305 3.461914 16.762695 3.237305 C 16.538086 3.012695 16.277668 2.83366 15.981445 2.700195 C 15.685221 2.566732 15.374349 2.5 15.048828 2.5 L 4.951172 2.5 C 4.619141 2.5 4.303385 2.568359 4.003906 2.705078 C 3.704427 2.841797 3.44401 3.02409 3.222656 3.251953 C 3.001302 3.479818 2.825521 3.745117 2.695312 4.047852 C 2.565104 4.350587 2.5 4.66797 2.5 5 L 13.310547 5 C 12.60091 5.266928 11.998697 5.683594 11.503906 6.25 L 2.5 6.25 L 2.5 15.048828 C 2.5 15.38737 2.568359 15.704753 2.705078 16.000977 C 2.841797 16.297201 3.024088 16.55599 3.251953 16.777344 C 3.479818 16.998697 3.745117 17.174479 4.047852 17.304688 C 4.350586 17.434896 4.667969 17.5 5 17.5 Z M 18.125 9.443359 C 18.125 9.866537 18.040363 10.263672 17.871094 10.634766 C 17.701822 11.005859 17.473957 11.329753 17.1875 11.606445 C 16.901041 11.883139 16.56901 12.101237 16.191406 12.260742 C 15.813802 12.420248 15.416666 12.5 15 12.5 C 14.563802 12.5 14.1569 12.41862 13.779297 12.255859 C 13.401691 12.0931 13.071288 11.870117 12.788086 11.586914 C 12.504882 11.303711 12.2819 10.973308 12.119141 10.595703 C 11.95638 10.2181 11.875 9.811198 11.875 9.375 C 11.875 8.938803 11.95638 8.531901 12.119141 8.154297 C 12.2819 7.776693 12.504882 7.446289 12.788086 7.163086 C 13.071288 6.879883 13.401691 6.656901 13.779297 6.494141 C 14.1569 6.331381 14.563802 6.25 15 6.25 C 15.449218 6.25 15.864257 6.333008 16.245117 6.499023 C 16.625977 6.665039 16.956379 6.892904 17.236328 7.182617 C 17.516275 7.472331 17.734375 7.810873 17.890625 8.198242 C 18.046875 8.585612 18.125 9.000651 18.125 9.443359 Z M 20 16.25 C 20 16.666666 19.926758 17.049154 19.780273 17.397461 C 19.633789 17.745768 19.435221 18.058268 19.18457 18.334961 C 18.933918 18.611654 18.642578 18.854166 18.310547 19.0625 C 17.978516 19.270834 17.626953 19.444986 17.255859 19.584961 C 16.884766 19.724936 16.505533 19.829102 16.118164 19.897461 C 15.730794 19.96582 15.358072 20 15 20 C 14.654947 20 14.291992 19.96582 13.911133 19.897461 C 13.530273 19.829102 13.154297 19.726562 12.783203 19.589844 C 12.412109 19.453125 12.058919 19.282227 11.723633 19.077148 C 11.388346 18.87207 11.092122 18.632812 10.834961 18.359375 C 10.577799 18.085938 10.374349 17.779947 10.224609 17.441406 C 10.074869 17.102865 10 16.731771 10 16.328125 L 10 15.78125 C 10 15.501303 10.052083 15.237631 10.15625 14.990234 C 10.260416 14.742839 10.405273 14.526367 10.59082 14.34082 C 10.776367 14.155273 10.991211 14.010417 11.235352 13.90625 C 11.479492 13.802084 11.744791 13.75 12.03125 13.75 L 17.96875 13.75 C 18.248697 13.75 18.512369 13.803711 18.759766 13.911133 C 19.00716 14.018555 19.222004 14.163412 19.404297 14.345703 C 19.586588 14.527995 19.731445 14.742839 19.838867 14.990234 C 19.946289 15.237631 20 15.501303 20 15.78125 Z " />
<TextBlock
Text="{x:Bind StartupEntityTitle}"
Grid.Column="1"
FontWeight="SemiBold" />
<TextBlock
Text="{x:Bind StartupEntityAddresses}"
Grid.Column="1"
Grid.Row="1" />
</Grid>
</DataTemplate>
<selectors:AccountReorderTemplateSelector
x:Key="AccountReorderTemplateSelector"
MergedAccountReorderTemplate="{StaticResource MergedAccountReorderTemplate}"
RootAccountReorderTemplate="{StaticResource RootAccountReorderTemplate}" />
</ContentDialog.Resources>
<ListView
CanReorderItems="True"
SelectionMode="None"
AllowDrop="True"
ItemsSource="{x:Bind Accounts}"
ItemTemplateSelector="{StaticResource AccountReorderTemplateSelector}" />
</ContentDialog>

View File

@@ -1,56 +0,0 @@
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class AccountReorderDialog : ContentDialog
{
public ObservableCollection<IAccountProviderDetailViewModel> Accounts { get; }
private int count;
private bool isOrdering = false;
private readonly IAccountService _accountService = App.Current.Services.GetService<IAccountService>();
public AccountReorderDialog(ObservableCollection<IAccountProviderDetailViewModel> accounts)
{
Accounts = accounts;
count = accounts.Count;
InitializeComponent();
}
private void DialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
Accounts.CollectionChanged -= AccountsChanged;
Accounts.CollectionChanged += AccountsChanged;
}
private void DialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args) => Accounts.CollectionChanged -= AccountsChanged;
private async void AccountsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (count - 1 == Accounts.Count)
isOrdering = true;
if (count == Accounts.Count && isOrdering)
{
// Order is completed. Apply changes.
var dict = Accounts.ToDictionary(a => a.StartupEntityId, a => Accounts.IndexOf(a));
await _accountService.UpdateAccountOrdersAsync(dict);
isOrdering = false;
}
}
}
}

View File

@@ -1,58 +0,0 @@
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public abstract class BaseAccountCreationDialog : ContentDialog, IAccountCreationDialog
{
public AccountCreationDialogState State
{
get { return (AccountCreationDialogState)GetValue(StateProperty); }
set { SetValue(StateProperty, value); }
}
public static readonly DependencyProperty StateProperty = DependencyProperty.Register(nameof(State), typeof(AccountCreationDialogState), typeof(BaseAccountCreationDialog), new PropertyMetadata(AccountCreationDialogState.Idle, OnStateChanged));
// Prevent users from dismissing it by ESC key.
private void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
{
if (args.Result == ContentDialogResult.None)
{
args.Cancel = true;
}
}
public void ShowDialog()
{
_ = ShowAsync();
}
public void Complete()
{
State = AccountCreationDialogState.Completed;
// Unregister from closing event.
Closing -= DialogClosing;
Hide();
}
private static void OnStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is BaseAccountCreationDialog dialog)
{
dialog.UpdateState();
}
}
public abstract void UpdateState();
}
}

View File

@@ -1,29 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.ConfirmationDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:domain="using:Wino.Core.Domain"
Title="{x:Bind DialogTitle, Mode=OneWay}"
Style="{StaticResource WinoDialogStyle}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Closed="DialogClosed"
PrimaryButtonText="{x:Bind ApproveButtonTitle, Mode=OneWay}"
DefaultButton="Primary"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
PrimaryButtonClick="ApproveClicked"
SecondaryButtonClick="CancelClicked"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMinWidth">250</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">500</x:Double>
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
</ContentDialog.Resources>
<TextBlock Text="{x:Bind Message, Mode=OneWay}" TextWrapping="Wrap" />
</ContentDialog>

View File

@@ -1,86 +0,0 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
#endif
namespace Wino.Dialogs
{
public sealed partial class ConfirmationDialog : ContentDialog, IConfirmationDialog
{
private TaskCompletionSource<bool> _completionSource;
#region Dependency Properties
public string DialogTitle
{
get { return (string)GetValue(DialogTitleProperty); }
set { SetValue(DialogTitleProperty, value); }
}
public static readonly DependencyProperty DialogTitleProperty = DependencyProperty.Register(nameof(DialogTitle), typeof(string), typeof(ConfirmationDialog), new PropertyMetadata(string.Empty));
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(nameof(Message), typeof(string), typeof(ConfirmationDialog), new PropertyMetadata(string.Empty));
public string ApproveButtonTitle
{
get { return (string)GetValue(ApproveButtonTitleProperty); }
set { SetValue(ApproveButtonTitleProperty, value); }
}
public static readonly DependencyProperty ApproveButtonTitleProperty = DependencyProperty.Register(nameof(ApproveButtonTitle), typeof(string), typeof(ConfirmationDialog), new PropertyMetadata(string.Empty));
#endregion
private bool _isApproved;
public ConfirmationDialog()
{
InitializeComponent();
}
public async Task<bool> ShowDialogAsync(string title, string message, string approveButtonTitle)
{
_completionSource = new TaskCompletionSource<bool>();
DialogTitle = title;
Message = message;
ApproveButtonTitle = approveButtonTitle;
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
ShowAsync();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
return await _completionSource.Task;
}
private void DialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
_completionSource.TrySetResult(_isApproved);
}
private void ApproveClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
_isApproved = true;
Hide();
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
_isApproved = false;
Hide();
}
}
}

View File

@@ -1,85 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.CustomThemeBuilderDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Wino.Dialogs"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Style="{StaticResource WinoDialogStyle}"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
FullSizeDesired="False"
xmlns:domain="using:Wino.Core.Domain"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
IsPrimaryButtonEnabled="False"
mc:Ignorable="d"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_ApplyTheme}"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
DefaultButton="Primary"
PrimaryButtonClick="ApplyClicked"
Title="{x:Bind domain:Translator.CustomThemeBuilder_Title}">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMinWidth">600</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">900</x:Double>
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
</ContentDialog.Resources>
<StackPanel Spacing="6">
<TextBlock x:Name="ErrorTextBlock" Foreground="Gold" />
<controls:SettingsCard Header="{x:Bind domain:Translator.CustomThemeBuilder_ThemeNameTitle}" Description="{x:Bind domain:Translator.CustomThemeBuilder_ThemeNameDescription}">
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 10 0.625 C 10 0.45573 10.061849 0.309246 10.185547 0.185547 C 10.309244 0.06185 10.455729 0 10.625 0 L 15.625 0 C 15.79427 0 15.940754 0.06185 16.064453 0.185547 C 16.18815 0.309246 16.25 0.45573 16.25 0.625 C 16.25 0.794271 16.18815 0.940756 16.064453 1.064453 C 15.940754 1.188152 15.79427 1.25 15.625 1.25 L 13.75 1.25 L 13.75 18.75 L 15.625 18.75 C 15.79427 18.75 15.940754 18.81185 16.064453 18.935547 C 16.18815 19.059244 16.25 19.205729 16.25 19.375 C 16.25 19.544271 16.18815 19.690756 16.064453 19.814453 C 15.940754 19.93815 15.79427 20 15.625 20 L 10.625 20 C 10.455729 20 10.309244 19.93815 10.185547 19.814453 C 10.061849 19.690756 10 19.544271 10 19.375 C 10 19.205729 10.061849 19.059244 10.185547 18.935547 C 10.309244 18.81185 10.455729 18.75 10.625 18.75 L 12.5 18.75 L 12.5 1.25 L 10.625 1.25 C 10.455729 1.25 10.309244 1.188152 10.185547 1.064453 C 10.061849 0.940756 10 0.794271 10 0.625 Z M 0 6.25 C 0 5.735678 0.097656 5.250651 0.292969 4.794922 C 0.488281 4.339193 0.756836 3.94043 1.098633 3.598633 C 1.44043 3.256836 1.837565 2.988281 2.290039 2.792969 C 2.742513 2.597656 3.229167 2.5 3.75 2.5 L 11.25 2.5 L 11.25 3.75 L 3.75 3.75 C 3.404948 3.75 3.081055 3.815105 2.77832 3.945312 C 2.475586 4.075521 2.210286 4.254558 1.982422 4.482422 C 1.754557 4.710287 1.575521 4.975587 1.445312 5.27832 C 1.315104 5.581056 1.25 5.904949 1.25 6.25 L 1.25 13.75 C 1.25 14.095053 1.315104 14.418945 1.445312 14.72168 C 1.575521 15.024414 1.754557 15.289714 1.982422 15.517578 C 2.210286 15.745443 2.475586 15.924479 2.77832 16.054688 C 3.081055 16.184896 3.404948 16.25 3.75 16.25 L 11.25 16.25 L 11.25 17.5 L 3.75 17.5 C 3.229167 17.5 2.742513 17.402344 2.290039 17.207031 C 1.837565 17.011719 1.44043 16.743164 1.098633 16.401367 C 0.756836 16.05957 0.488281 15.662436 0.292969 15.209961 C 0.097656 14.757487 0 14.270834 0 13.75 Z M 15 3.75 L 15 2.5 L 16.25 2.5 C 16.764322 2.5 17.249348 2.597656 17.705078 2.792969 C 18.160807 2.988281 18.55957 3.256836 18.901367 3.598633 C 19.243164 3.94043 19.511719 4.339193 19.707031 4.794922 C 19.902344 5.250651 20 5.735678 20 6.25 L 20 13.75 C 20 14.270834 19.902344 14.757487 19.707031 15.209961 C 19.511719 15.662436 19.243164 16.05957 18.901367 16.401367 C 18.55957 16.743164 18.160807 17.011719 17.705078 17.207031 C 17.249348 17.402344 16.764322 17.5 16.25 17.5 L 15 17.5 L 15 16.25 L 16.25 16.25 C 16.595051 16.25 16.918945 16.184896 17.22168 16.054688 C 17.524414 15.924479 17.789713 15.745443 18.017578 15.517578 C 18.245441 15.289714 18.424479 15.024414 18.554688 14.72168 C 18.684895 14.418945 18.75 14.095053 18.75 13.75 L 18.75 6.25 C 18.75 5.904949 18.684895 5.581056 18.554688 5.27832 C 18.424479 4.975587 18.245441 4.710287 18.017578 4.482422 C 17.789713 4.254558 17.524414 4.075521 17.22168 3.945312 C 16.918945 3.815105 16.595051 3.75 16.25 3.75 Z M 7.441406 5.361328 C 7.389323 5.250651 7.312825 5.162761 7.211914 5.097656 C 7.111002 5.032553 6.998697 5.000001 6.875 5 C 6.751302 5.000001 6.638997 5.032553 6.538086 5.097656 C 6.437174 5.162761 6.360677 5.250651 6.308594 5.361328 L 2.871094 12.861328 C 2.799479 13.017578 2.792969 13.177084 2.851562 13.339844 C 2.910156 13.502604 3.017578 13.619792 3.173828 13.691406 C 3.330078 13.763021 3.489583 13.769531 3.652344 13.710938 C 3.815104 13.652344 3.932292 13.544922 4.003906 13.388672 L 4.84375 11.5625 L 8.896484 11.5625 L 8.90625 11.5625 L 9.746094 13.388672 C 9.817708 13.544922 9.934896 13.652344 10.097656 13.710938 C 10.260416 13.769531 10.419922 13.763021 10.576172 13.691406 C 10.732422 13.619792 10.839844 13.502604 10.898438 13.339844 C 10.957031 13.177084 10.950521 13.017578 10.878906 12.861328 Z M 5.410156 10.3125 L 6.875 7.128906 L 8.339844 10.3125 Z " />
</controls:SettingsCard.HeaderIcon>
<controls:SettingsCard.Content>
<TextBox x:Name="ThemeNameBox" />
</controls:SettingsCard.Content>
</controls:SettingsCard>
<controls:SettingsCard
Header="{x:Bind domain:Translator.CustomThemeBuilder_WallpaperTitle}"
x:Name="CustomWallpaperCard"
Description="{x:Bind domain:Translator.CustomThemeBuilder_WallpaperDescription}">
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 4.921875 16.25 C 4.433594 16.25 3.966471 16.150717 3.520508 15.952148 C 3.074544 15.753581 2.683919 15.486654 2.348633 15.151367 C 2.013346 14.816081 1.746419 14.425456 1.547852 13.979492 C 1.349284 13.533529 1.25 13.066406 1.25 12.578125 L 1.25 4.921875 C 1.25 4.433594 1.349284 3.966473 1.547852 3.520508 C 1.746419 3.074545 2.013346 2.68392 2.348633 2.348633 C 2.683919 2.013348 3.074544 1.74642 3.520508 1.547852 C 3.966471 1.349285 4.433594 1.25 4.921875 1.25 L 12.578125 1.25 C 13.066406 1.25 13.533528 1.349285 13.979492 1.547852 C 14.425455 1.74642 14.81608 2.013348 15.151367 2.348633 C 15.486653 2.68392 15.75358 3.074545 15.952148 3.520508 C 16.150715 3.966473 16.25 4.433594 16.25 4.921875 L 16.25 12.578125 C 16.25 13.066406 16.150715 13.533529 15.952148 13.979492 C 15.75358 14.425456 15.486653 14.816081 15.151367 15.151367 C 14.81608 15.486654 14.425455 15.753581 13.979492 15.952148 C 13.533528 16.150717 13.066406 16.25 12.578125 16.25 Z M 8.75 8.90625 C 9.082031 8.90625 9.401041 8.969727 9.707031 9.09668 C 10.013021 9.223633 10.283203 9.404297 10.517578 9.638672 L 14.658203 13.769531 C 14.768879 13.580729 14.853515 13.377279 14.912109 13.15918 C 14.970702 12.941081 14.999999 12.721354 15 12.5 L 15 4.951172 C 14.999999 4.625651 14.933268 4.314779 14.799805 4.018555 C 14.666341 3.722332 14.487305 3.461914 14.262695 3.237305 C 14.038086 3.012695 13.777669 2.83366 13.481445 2.700195 C 13.185221 2.566732 12.874348 2.5 12.548828 2.5 L 4.951172 2.5 C 4.625651 2.5 4.314778 2.566732 4.018555 2.700195 C 3.722331 2.83366 3.461914 3.012695 3.237305 3.237305 C 3.012695 3.461914 2.833659 3.722332 2.700195 4.018555 C 2.566732 4.314779 2.5 4.625651 2.5 4.951172 L 2.5 12.5 C 2.5 12.721354 2.529297 12.941081 2.587891 13.15918 C 2.646484 13.377279 2.73112 13.580729 2.841797 13.769531 L 6.982422 9.638672 C 7.216797 9.404297 7.486979 9.223633 7.792969 9.09668 C 8.098958 8.969727 8.417969 8.90625 8.75 8.90625 Z M 10.625 5.625 C 10.625 5.449219 10.657552 5.286459 10.722656 5.136719 C 10.78776 4.98698 10.877278 4.855145 10.991211 4.741211 C 11.105143 4.627279 11.236979 4.537761 11.386719 4.472656 C 11.536458 4.407553 11.699219 4.375 11.875 4.375 C 12.04427 4.375 12.205402 4.407553 12.358398 4.472656 C 12.511393 4.537761 12.644856 4.627279 12.758789 4.741211 C 12.872721 4.855145 12.962239 4.988607 13.027344 5.141602 C 13.092447 5.294597 13.124999 5.455729 13.125 5.625 C 13.124999 5.800781 13.092447 5.963542 13.027344 6.113281 C 12.962239 6.263021 12.872721 6.394857 12.758789 6.508789 C 12.644856 6.622722 12.513021 6.71224 12.363281 6.777344 C 12.213541 6.842449 12.050781 6.875001 11.875 6.875 C 11.699219 6.875001 11.53483 6.842449 11.381836 6.777344 C 11.228841 6.71224 11.097005 6.62435 10.986328 6.513672 C 10.87565 6.402996 10.78776 6.27116 10.722656 6.118164 C 10.657552 5.96517 10.625 5.800781 10.625 5.625 Z M 7.5 18.75 C 6.966146 18.75 6.455078 18.642578 5.966797 18.427734 C 5.478516 18.212891 5.058594 17.903646 4.707031 17.5 L 13.193359 17.5 C 13.785807 17.5 14.344075 17.382812 14.868164 17.148438 C 15.392252 16.914062 15.849609 16.59668 16.240234 16.196289 C 16.630859 15.795898 16.938477 15.332031 17.163086 14.804688 C 17.387695 14.277344 17.5 13.717448 17.5 13.125 L 17.5 4.707031 C 17.903645 5.058595 18.212891 5.478517 18.427734 5.966797 C 18.642578 6.455079 18.75 6.966146 18.75 7.5 L 18.75 13.125 C 18.75 13.89974 18.601887 14.628906 18.305664 15.3125 C 18.009439 15.996094 17.607422 16.591797 17.099609 17.099609 C 16.591797 17.607422 15.996094 18.009439 15.3125 18.305664 C 14.628906 18.601889 13.899739 18.75 13.125 18.75 Z M 12.5 15 C 12.721354 15 12.94108 14.970703 13.15918 14.912109 C 13.377278 14.853516 13.580729 14.768881 13.769531 14.658203 L 9.638672 10.517578 C 9.391275 10.270183 9.095052 10.146484 8.75 10.146484 C 8.404947 10.146484 8.108724 10.270183 7.861328 10.517578 L 3.730469 14.658203 C 3.919271 14.768881 4.122721 14.853516 4.34082 14.912109 C 4.558919 14.970703 4.778646 15 5 15 Z " />
</controls:SettingsCard.HeaderIcon>
<controls:SettingsCard.Content>
<Button Content="{x:Bind domain:Translator.Buttons_Browse}" Click="BrowseWallpaperClicked" />
</controls:SettingsCard.Content>
</controls:SettingsCard>
<controls:SettingsCard Header="{x:Bind domain:Translator.CustomThemeBuilder_AccentColorTitle}" Description="{x:Bind domain:Translator.CustomThemeBuilder_AccentColorDescription}">
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 4.921875 16.25 C 4.433594 16.25 3.966471 16.150717 3.520508 15.952148 C 3.074544 15.753581 2.683919 15.486654 2.348633 15.151367 C 2.013346 14.816081 1.746419 14.425456 1.547852 13.979492 C 1.349284 13.533529 1.25 13.066406 1.25 12.578125 L 1.25 4.921875 C 1.25 4.433594 1.349284 3.966473 1.547852 3.520508 C 1.746419 3.074545 2.013346 2.68392 2.348633 2.348633 C 2.683919 2.013348 3.074544 1.74642 3.520508 1.547852 C 3.966471 1.349285 4.433594 1.25 4.921875 1.25 L 12.578125 1.25 C 13.066406 1.25 13.533528 1.349285 13.979492 1.547852 C 14.425455 1.74642 14.81608 2.013348 15.151367 2.348633 C 15.486653 2.68392 15.75358 3.074545 15.952148 3.520508 C 16.150715 3.966473 16.25 4.433594 16.25 4.921875 L 16.25 12.578125 C 16.25 13.066406 16.150715 13.533529 15.952148 13.979492 C 15.75358 14.425456 15.486653 14.816081 15.151367 15.151367 C 14.81608 15.486654 14.425455 15.753581 13.979492 15.952148 C 13.533528 16.150717 13.066406 16.25 12.578125 16.25 Z M 8.75 8.90625 C 9.082031 8.90625 9.401041 8.969727 9.707031 9.09668 C 10.013021 9.223633 10.283203 9.404297 10.517578 9.638672 L 14.658203 13.769531 C 14.768879 13.580729 14.853515 13.377279 14.912109 13.15918 C 14.970702 12.941081 14.999999 12.721354 15 12.5 L 15 4.951172 C 14.999999 4.625651 14.933268 4.314779 14.799805 4.018555 C 14.666341 3.722332 14.487305 3.461914 14.262695 3.237305 C 14.038086 3.012695 13.777669 2.83366 13.481445 2.700195 C 13.185221 2.566732 12.874348 2.5 12.548828 2.5 L 4.951172 2.5 C 4.625651 2.5 4.314778 2.566732 4.018555 2.700195 C 3.722331 2.83366 3.461914 3.012695 3.237305 3.237305 C 3.012695 3.461914 2.833659 3.722332 2.700195 4.018555 C 2.566732 4.314779 2.5 4.625651 2.5 4.951172 L 2.5 12.5 C 2.5 12.721354 2.529297 12.941081 2.587891 13.15918 C 2.646484 13.377279 2.73112 13.580729 2.841797 13.769531 L 6.982422 9.638672 C 7.216797 9.404297 7.486979 9.223633 7.792969 9.09668 C 8.098958 8.969727 8.417969 8.90625 8.75 8.90625 Z M 10.625 5.625 C 10.625 5.449219 10.657552 5.286459 10.722656 5.136719 C 10.78776 4.98698 10.877278 4.855145 10.991211 4.741211 C 11.105143 4.627279 11.236979 4.537761 11.386719 4.472656 C 11.536458 4.407553 11.699219 4.375 11.875 4.375 C 12.04427 4.375 12.205402 4.407553 12.358398 4.472656 C 12.511393 4.537761 12.644856 4.627279 12.758789 4.741211 C 12.872721 4.855145 12.962239 4.988607 13.027344 5.141602 C 13.092447 5.294597 13.124999 5.455729 13.125 5.625 C 13.124999 5.800781 13.092447 5.963542 13.027344 6.113281 C 12.962239 6.263021 12.872721 6.394857 12.758789 6.508789 C 12.644856 6.622722 12.513021 6.71224 12.363281 6.777344 C 12.213541 6.842449 12.050781 6.875001 11.875 6.875 C 11.699219 6.875001 11.53483 6.842449 11.381836 6.777344 C 11.228841 6.71224 11.097005 6.62435 10.986328 6.513672 C 10.87565 6.402996 10.78776 6.27116 10.722656 6.118164 C 10.657552 5.96517 10.625 5.800781 10.625 5.625 Z M 7.5 18.75 C 6.966146 18.75 6.455078 18.642578 5.966797 18.427734 C 5.478516 18.212891 5.058594 17.903646 4.707031 17.5 L 13.193359 17.5 C 13.785807 17.5 14.344075 17.382812 14.868164 17.148438 C 15.392252 16.914062 15.849609 16.59668 16.240234 16.196289 C 16.630859 15.795898 16.938477 15.332031 17.163086 14.804688 C 17.387695 14.277344 17.5 13.717448 17.5 13.125 L 17.5 4.707031 C 17.903645 5.058595 18.212891 5.478517 18.427734 5.966797 C 18.642578 6.455079 18.75 6.966146 18.75 7.5 L 18.75 13.125 C 18.75 13.89974 18.601887 14.628906 18.305664 15.3125 C 18.009439 15.996094 17.607422 16.591797 17.099609 17.099609 C 16.591797 17.607422 15.996094 18.009439 15.3125 18.305664 C 14.628906 18.601889 13.899739 18.75 13.125 18.75 Z M 12.5 15 C 12.721354 15 12.94108 14.970703 13.15918 14.912109 C 13.377278 14.853516 13.580729 14.768881 13.769531 14.658203 L 9.638672 10.517578 C 9.391275 10.270183 9.095052 10.146484 8.75 10.146484 C 8.404947 10.146484 8.108724 10.270183 7.861328 10.517578 L 3.730469 14.658203 C 3.919271 14.768881 4.122721 14.853516 4.34082 14.912109 C 4.558919 14.970703 4.778646 15 5 15 Z " />
</controls:SettingsCard.HeaderIcon>
<controls:SettingsCard.Content>
<Button>
<Button.Content>
<StackPanel Orientation="Horizontal" Spacing="12">
<TextBlock Text="{x:Bind domain:Translator.CustomThemeBuilder_PickColor}" />
<Grid
x:Name="PreviewAccentColorGrid"
Width="20"
Background="{ThemeResource SystemAccentColor}"
Height="20" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout Placement="Bottom">
<muxc:ColorPicker
ColorSpectrumShape="Box"
ColorChanged="PickerColorChanged"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
IsAlphaEnabled="False"
IsAlphaSliderVisible="False"
IsAlphaTextInputVisible="False" />
</Flyout>
</Button.Flyout>
</Button>
</controls:SettingsCard.Content>
</controls:SettingsCard>
</StackPanel>
</ContentDialog>

View File

@@ -1,72 +0,0 @@
using System;
using CommunityToolkit.WinUI.Helpers;
using Microsoft.Extensions.DependencyInjection;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
#endif
namespace Wino.Dialogs
{
public sealed partial class CustomThemeBuilderDialog : ContentDialog
{
public byte[] WallpaperData { get; private set; }
public string AccentColor { get; private set; }
private IThemeService _themeService;
public CustomThemeBuilderDialog()
{
InitializeComponent();
_themeService = App.Current.Services.GetService<IThemeService>();
}
private async void ApplyClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
if (Array.Empty<byte>() == WallpaperData)
return;
var deferal = args.GetDeferral();
try
{
await _themeService.CreateNewCustomThemeAsync(ThemeNameBox.Text, AccentColor, WallpaperData);
}
catch (Exception exception)
{
ErrorTextBlock.Text = exception.Message;
}
finally
{
deferal.Complete();
}
}
private async void BrowseWallpaperClicked(object sender, RoutedEventArgs e)
{
var dialogService = App.Current.Services.GetService<IDialogService>();
var pickedFileData = await dialogService.PickWindowsFileContentAsync(".jpg", ".png");
if (pickedFileData == Array.Empty<byte>()) return;
IsPrimaryButtonEnabled = true;
WallpaperData = pickedFileData;
}
private void PickerColorChanged(Microsoft.UI.Xaml.Controls.ColorPicker sender, Microsoft.UI.Xaml.Controls.ColorChangedEventArgs args)
{
PreviewAccentColorGrid.Background = new SolidColorBrush(args.NewColor);
AccentColor = args.NewColor.ToHex();
}
}
}

View File

@@ -1,59 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.MoveMailDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Wino.Controls"
xmlns:helpers="using:Wino.Helpers"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:folders="using:Wino.Core.Domain.Models.Folders"
Title="{x:Bind domain:Translator.MoveMailDialog_Title}"
Style="{StaticResource WinoDialogStyle}"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
xmlns:domain="using:Wino.Core.Domain"
DefaultButton="Primary"
PrimaryButtonClick="CancelClicked"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMinWidth">600</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">600</x:Double>
<x:Double x:Key="ContentDialogMinHeight">756</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
<DataTemplate x:Key="FolderStructureMenuFlyoutItemTemplate" x:DataType="folders:IMailItemFolder">
<muxc:TreeViewItem ItemsSource="{x:Bind ChildFolders}" IsExpanded="True">
<StackPanel
Height="32"
Orientation="Horizontal"
Spacing="12">
<controls:WinoFontIcon FontSize="20" Icon="{x:Bind helpers:XamlHelpers.GetSpecialFolderPathIconGeometry(SpecialFolderType)}" />
<TextBlock VerticalAlignment="Center" Text="{x:Bind FolderName}" />
</StackPanel>
</muxc:TreeViewItem>
</DataTemplate>
</ContentDialog.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
x:Name="InvalidFolderText"
Margin="0,0,0,6"
Visibility="Collapsed"
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}" />
<muxc:TreeView
x:Name="FolderTreeView"
Grid.Row="1"
CanDragItems="False"
SelectedItem="{x:Bind SelectedFolder, Mode=TwoWay}"
ItemTemplate="{StaticResource FolderStructureMenuFlyoutItemTemplate}"
ItemsSource="{x:Bind FolderList, Mode=OneWay}"
SelectionMode="Single" />
</Grid>
</ContentDialog>

View File

@@ -1,81 +0,0 @@
using System.Collections.Generic;
using Wino.Core.Domain;
using Wino.Core.Domain.Models.Folders;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
#endif
namespace Wino.Dialogs
{
public sealed partial class MoveMailDialog : ContentDialog
{
public IMailItemFolder SelectedFolder
{
get { return (IMailItemFolder)GetValue(SelectedFolderProperty); }
set { SetValue(SelectedFolderProperty, value); }
}
public static readonly DependencyProperty SelectedFolderProperty = DependencyProperty.Register(nameof(SelectedFolder), typeof(IMailItemFolder), typeof(MoveMailDialog), new PropertyMetadata(null, OnSelectedFolderChanged));
public List<IMailItemFolder> FolderList { get; set; }
public MoveMailDialog(List<IMailItemFolder> allFolders)
{
InitializeComponent();
if (allFolders == null) return;
FolderList = allFolders;
}
private static void OnSelectedFolderChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is MoveMailDialog dialog)
{
dialog.VerifySelection();
}
}
private void VerifySelection()
{
if (SelectedFolder != null)
{
// Don't select non-move capable folders like Categories or More.
if (!SelectedFolder.IsMoveTarget)
{
// Warn users for only proper mail folders. Not ghost folders.
InvalidFolderText.Visibility = Visibility.Visible;
InvalidFolderText.Text = string.Format(Translator.MoveMailDialog_InvalidFolderMessage, SelectedFolder.FolderName);
if (FolderTreeView.SelectedItem != null)
{
// Toggle the expansion for the selected container if available.
// I don't like the expand arrow touch area. It's better this way.
if (FolderTreeView.ContainerFromItem(FolderTreeView.SelectedItem) is Microsoft.UI.Xaml.Controls.TreeViewItem container)
{
container.IsExpanded = !container.IsExpanded;
}
}
SelectedFolder = null;
}
else
{
Hide();
}
}
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Hide();
}
}
}

View File

@@ -1,89 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.NewAccountDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
Title="{x:Bind domain:Translator.NewAccountDialog_Title}"
Style="{StaticResource WinoDialogStyle}"
HorizontalContentAlignment="Stretch"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
IsPrimaryButtonEnabled="False"
Opened="DialogOpened"
xmlns:domain="using:Wino.Core.Domain"
PrimaryButtonClick="CreateClicked"
DefaultButton="Primary"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_CreateAccount}"
SecondaryButtonClick="CancelClicked"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
mc:Ignorable="d">
<ContentDialog.Resources>
<DataTemplate x:Key="NewMailProviderTemplate" x:DataType="accounts:ProviderDetail">
<Grid Padding="6" Margin="0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image
Width="35"
Height="35"
Source="{x:Bind ProviderImage}" />
<StackPanel
Spacing="2"
Grid.Column="1"
Margin="12,0"
VerticalAlignment="Center">
<TextBlock FontWeight="Bold" Text="{x:Bind Name}" />
<TextBlock Text="{x:Bind Description}" />
</StackPanel>
</Grid>
</DataTemplate>
</ContentDialog.Resources>
<Grid MinWidth="400" RowSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Account Name -->
<TextBox
x:Name="AccountNameTextbox"
Header="{x:Bind domain:Translator.NewAccountDialog_AccountName}"
PlaceholderText="{x:Bind domain:Translator.NewAccountDialog_AccountNamePlaceholder}"
TextChanged="AccountNameChanged" />
<!-- Sender Name -->
<TextBox
x:Name="SenderNameTextbox"
Grid.Row="1"
Header="{x:Bind domain:Translator.AccountSettingsDialog_AccountName}"
PlaceholderText="{x:Bind domain:Translator.AccountSettingsDialog_AccountNamePlaceholder}"
TextChanged="SenderNameChanged" />
<!--
TODO: Move Name, Sender Name and Color Picker to another Frame.
Provider selection should be first, then account details.
-->
<!--<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Color" />
<muxc:ColorPicker x:Name="AccountColorPicker" Grid.Column="1" />
</Grid>-->
<ListView
Grid.Row="2"
Margin="0,12"
Padding="0"
ItemTemplate="{StaticResource NewMailProviderTemplate}"
ItemsSource="{x:Bind Providers}"
SelectedItem="{x:Bind SelectedMailProvider, Mode=TwoWay}"
SelectionMode="Single" />
</Grid>
</ContentDialog>

View File

@@ -1,91 +0,0 @@
using System.Collections.Generic;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Accounts;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
#endif
namespace Wino.Dialogs
{
public sealed partial class NewAccountDialog : ContentDialog
{
/// <summary>
/// Gets or sets current selected mail provider in the dialog.
/// </summary>
public ProviderDetail SelectedMailProvider
{
get { return (ProviderDetail)GetValue(SelectedMailProviderProperty); }
set { SetValue(SelectedMailProviderProperty, value); }
}
public static readonly DependencyProperty SelectedMailProviderProperty = DependencyProperty.Register(nameof(SelectedMailProvider), typeof(ProviderDetail), typeof(NewAccountDialog), new PropertyMetadata(null, new PropertyChangedCallback(OnSelectedProviderChanged)));
// List of available mail providers for now.
public List<IProviderDetail> Providers { get; set; }
public AccountCreationDialogResult Result = null;
public NewAccountDialog()
{
InitializeComponent();
// AccountColorPicker.Color = Colors.Blue;
}
private static void OnSelectedProviderChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is NewAccountDialog dialog)
dialog.Validate();
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Hide();
}
private void CreateClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Validate();
if (IsSecondaryButtonEnabled)
{
Result = new AccountCreationDialogResult(SelectedMailProvider.Type, AccountNameTextbox.Text.Trim(), SenderNameTextbox.Text.Trim());
Hide();
}
}
private void AccountNameChanged(object sender, TextChangedEventArgs e) => Validate();
private void SenderNameChanged(object sender, TextChangedEventArgs e) => Validate();
private void Validate()
{
ValidateCreateButton();
ValidateNames();
}
// Returns whether we can create account or not.
private void ValidateCreateButton()
{
bool shouldEnable = SelectedMailProvider != null
&& SelectedMailProvider.IsSupported
&& !string.IsNullOrEmpty(AccountNameTextbox.Text)
&& (SelectedMailProvider.RequireSenderNameOnCreationDialog ? !string.IsNullOrEmpty(SenderNameTextbox.Text) : true);
IsPrimaryButtonEnabled = shouldEnable;
}
private void ValidateNames()
{
AccountNameTextbox.IsEnabled = SelectedMailProvider != null;
SenderNameTextbox.IsEnabled = SelectedMailProvider != null && SelectedMailProvider.Type != Core.Domain.Enums.MailProviderType.IMAP4;
}
private void DialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args) => Validate();
}
}

View File

@@ -1,25 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.NewImapSetupDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Wino.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Style="{StaticResource WinoDialogStyle}"
DefaultButton="Secondary"
Closing="OnDialogClosing"
Closed="ImapSetupDialogClosed"
Opened="ImapSetupDialogOpened"
FullSizeDesired="False"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ContentDialog.Resources>
<Thickness x:Key="ContentDialogPadding">0,0,0,0</Thickness>
<!--<x:Double x:Key="ContentDialogMinWidth">768</x:Double>-->
<x:Double x:Key="ContentDialogMaxWidth">1920</x:Double>
<!--<x:Double x:Key="ContentDialogMinHeight">768</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">2000</x:Double>-->
</ContentDialog.Resources>
<Frame x:Name="ImapFrame" />
</ContentDialog>

View File

@@ -1,104 +0,0 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Messages.Mails;
using Wino.Views.ImapSetup;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
#endif
namespace Wino.Dialogs
{
public enum ImapSetupState
{
Welcome,
AutoDiscovery,
TestingConnection,
PreparingFolder
}
public sealed partial class NewImapSetupDialog : ContentDialog,
IRecipient<ImapSetupNavigationRequested>,
IRecipient<ImapSetupBackNavigationRequested>,
IRecipient<ImapSetupDismissRequested>,
ICustomServerAccountCreationDialog
{
private TaskCompletionSource<CustomServerInformation> _getServerInfoTaskCompletionSource = new TaskCompletionSource<CustomServerInformation>();
private bool isDismissRequested = false;
public NewImapSetupDialog()
{
InitializeComponent();
}
// Not used for now.
public AccountCreationDialogState State { get; set; }
public void Complete()
{
if (!_getServerInfoTaskCompletionSource.Task.IsCompleted)
_getServerInfoTaskCompletionSource.TrySetResult(null);
isDismissRequested = true;
Hide();
}
public Task<CustomServerInformation> GetCustomServerInformationAsync() => _getServerInfoTaskCompletionSource.Task;
public async void Receive(ImapSetupBackNavigationRequested message)
{
// Frame go back
if (message.PageType == null)
{
if (ImapFrame.CanGoBack)
{
// Go back using Dispatcher to allow navigations in OnNavigatedTo.
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
ImapFrame.GoBack();
});
}
}
else
{
ImapFrame.Navigate(message.PageType, message.Parameter, new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromLeft });
}
}
public void Receive(ImapSetupNavigationRequested message)
{
ImapFrame.Navigate(message.PageType, message.Parameter, new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromRight });
}
public void Receive(ImapSetupDismissRequested message) => _getServerInfoTaskCompletionSource.TrySetResult(message.CompletedServerInformation);
public void ShowDialog() => _ = ShowAsync();
public void ShowPreparingFolders()
{
ImapFrame.Navigate(typeof(PreparingImapFoldersPage), new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromLeft });
}
public void StartImapConnectionSetup(MailAccount account) => ImapFrame.Navigate(typeof(WelcomeImapSetupPage), account, new DrillInNavigationTransitionInfo());
private void ImapSetupDialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args) => WeakReferenceMessenger.Default.UnregisterAll(this);
private void ImapSetupDialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args) => WeakReferenceMessenger.Default.RegisterAll(this);
// Don't hide the dialog unless dismiss is requested from the inner pages specifically.
private void OnDialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args) => args.Cancel = !isDismissRequested;
}
}

View File

@@ -1,262 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.SignatureEditorDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
xmlns:controls="using:Wino.Controls"
xmlns:controls1="using:CommunityToolkit.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"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Title="{x:Bind domain:Translator.SignatureEditorDialog_Title}"
HorizontalContentAlignment="Stretch"
Closed="DialogClosed"
DefaultButton="Primary"
IsPrimaryButtonEnabled="False"
Opened="SignatureDialogOpened"
PrimaryButtonClick="SaveClicked"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Save}"
SecondaryButtonClick="CancelClicked"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
Style="{StaticResource WinoDialogStyle}"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMaxWidth">1200</x:Double>
</ContentDialog.Resources>
<Grid Margin="0,20,0,0" RowSpacing="30">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" MaxHeight="400" />
</Grid.RowDefinitions>
<TextBox
x:Name="SignatureNameTextBox"
MinWidth="300"
MaxWidth="500"
HorizontalAlignment="Left"
PlaceholderText="{x:Bind domain:Translator.SignatureEditorDialog_SignatureName_Placeholder}"
TextChanged="SignatureNameTextBoxTextChanged" />
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="300" />
</Grid.RowDefinitions>
<CommandBar
Grid.Row="0"
HorizontalAlignment="Left"
Background="Transparent"
DefaultLabelPosition="Collapsed"
IsOpen="False">
<AppBarButton
Width="48"
Click="InvertComposerThemeClicked"
LabelPosition="Collapsed"
ToolTipService.ToolTip="Light Theme"
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay}">
<AppBarButton.Icon>
<controls:WinoFontIcon Icon="LightEditor" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
Width="48"
Click="InvertComposerThemeClicked"
LabelPosition="Collapsed"
ToolTipService.ToolTip="Dark Theme"
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay, Converter={StaticResource ReverseBooleanToVisibilityConverter}}">
<AppBarButton.Icon>
<controls:WinoFontIcon Icon="DarkEditor" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarSeparator />
<AppBarToggleButton
x:Name="BoldButton"
Width="48"
Click="BoldButtonClicked"
Label="Bold"
ToolTipService.ToolTip="Bold">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BoldPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="ItalicButton"
Width="48"
Click="ItalicButtonClicked"
Label="Italic"
ToolTipService.ToolTip="Italic">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource ItalicPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="UnderlineButton"
Width="48"
Click="UnderlineButtonClicked"
Label="Underline"
ToolTipService.ToolTip="Underline">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="StrokeButton"
Width="48"
Click="StrokeButtonClicked"
Label="Stroke"
ToolTipService.ToolTip="Stroke">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource StrikePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator />
<AppBarToggleButton
x:Name="BulletListButton"
Width="48"
Click="BulletListButtonClicked"
Label="Bullet List"
ToolTipService.ToolTip="Bullet List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BulletedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="OrderedListButton"
Width="48"
Click="OrderedListButtonClicked"
Label="Ordered List"
ToolTipService.ToolTip="Ordered List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource OrderedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator />
<AppBarButton
x:Name="DecreaseIndentButton"
Width="48"
Click="DecreaseIndentClicked"
Label="Decrease Indent"
ToolTipService.ToolTip="Decrease Indent">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource DecreaseIndentPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
x:Name="IncreaseIndentButton"
Width="48"
Click="IncreaseIndentClicked"
Label="Increase Indent"
ToolTipService.ToolTip="Increase Indent">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource IncreaseIndentPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarElementContainer VerticalAlignment="Center">
<ComboBox
x:Name="AlignmentListView"
Background="Transparent"
BorderBrush="Transparent"
SelectionChanged="AlignmentChanged">
<ComboBoxItem IsSelected="True" Tag="left">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignLeftPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="center">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignCenterPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="right">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignRightPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="justify">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</AppBarElementContainer>
<AppBarSeparator />
<AppBarButton
x:Name="AddImageButton"
Width="48"
Click="AddImageClicked"
Label="Add Image"
ToolTipService.ToolTip="{x:Bind domain:Translator.Photos}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
</AppBarButton.Icon>
<AppBarButton.Content>
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16" VerticalAlignment="Center">
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
</Viewbox>
<TextBlock Text="{x:Bind domain:Translator.Photos}" />
</StackPanel>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton
x:Name="EmojiButton"
Width="48"
Click="EmojiButtonClicked"
Label="Add Emoji"
ToolTipService.ToolTip="{x:Bind domain:Translator.Emoji}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource EmojiPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarToggleButton
x:Name="WebviewToolBarButton"
Width="48"
Click="WebViewToggleButtonClicked"
Label="Webview ToolBar"
ToolTipService.ToolTip="Webview ToolBar">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource WebviewToolBarPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
</CommandBar>
<Border
Grid.Row="1"
Margin="0,6,0,0"
BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="3">
<Grid CornerRadius="3">
<Grid Background="White" Visibility="{x:Bind IsComposerDarkMode, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}" />
<muxc:WebView2 x:Name="Chromium" />
</Grid>
</Border>
</Grid>
</Grid>
</ContentDialog>

View File

@@ -1,377 +0,0 @@
using System;
using System.Text.RegularExpressions;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Web.WebView2.Core;
using Windows.UI.ViewManagement.Core;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Reader;
using Wino.Views.Settings;
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class SignatureEditorDialog : ContentDialog
{
private Func<Task<string>> _getHTMLBodyFunction;
private readonly TaskCompletionSource<bool> _domLoadedTask = new TaskCompletionSource<bool>();
private readonly INativeAppService _nativeAppService = App.Current.Services.GetService<INativeAppService>();
public AccountSignature Result;
public bool IsComposerDarkMode
{
get { return (bool)GetValue(IsComposerDarkModeProperty); }
set { SetValue(IsComposerDarkModeProperty, value); }
}
public static readonly DependencyProperty IsComposerDarkModeProperty = DependencyProperty.Register(nameof(IsComposerDarkMode), typeof(bool), typeof(SignatureManagementPage), new PropertyMetadata(false, OnIsComposerDarkModeChanged));
public SignatureEditorDialog()
{
InitializeComponent();
SignatureNameTextBox.Header = Translator.SignatureEditorDialog_SignatureName_TitleNew;
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,msOverlayScrollbarWinStyle,msOverlayScrollbarWinStyleAnimation");
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
IsPrimaryButtonEnabled = true;
}
public SignatureEditorDialog(AccountSignature signatureModel)
{
InitializeComponent();
SignatureNameTextBox.Text = signatureModel.Name.Trim();
SignatureNameTextBox.Header = string.Format(Translator.SignatureEditorDialog_SignatureName_TitleEdit, signatureModel.Name);
Result = new AccountSignature
{
Id = signatureModel.Id,
Name = signatureModel.Name,
MailAccountId = signatureModel.MailAccountId,
HtmlBody = signatureModel.HtmlBody
};
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,msOverlayScrollbarWinStyle,msOverlayScrollbarWinStyleAnimation");
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
IsPrimaryButtonEnabled = true;
}
private async void SignatureDialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
Chromium.CoreWebView2Initialized -= ChromiumInitialized;
Chromium.CoreWebView2Initialized += ChromiumInitialized;
await Chromium.EnsureCoreWebView2Async();
_getHTMLBodyFunction = new Func<Task<string>>(async () =>
{
var editorContent = await InvokeScriptSafeAsync("GetHTMLContent();");
return JsonSerializer.Deserialize<string>(editorContent);
});
var underlyingThemeService = App.Current.Services.GetService<IUnderlyingThemeService>();
IsComposerDarkMode = underlyingThemeService.IsUnderlyingThemeDark();
await RenderInternalAsync(Result?.HtmlBody ?? string.Empty);
}
private void DialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
Chromium.CoreWebView2Initialized -= ChromiumInitialized;
if (Chromium.CoreWebView2 != null)
{
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
}
}
private async void SaveClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
var newSignature = Regex.Unescape(await _getHTMLBodyFunction());
if (Result == null)
{
Result = new AccountSignature
{
Id = Guid.NewGuid(),
Name = SignatureNameTextBox.Text.Trim(),
HtmlBody = newSignature
};
}
else
{
Result.Name = SignatureNameTextBox.Text.Trim();
Result.HtmlBody = newSignature;
}
Hide();
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Hide();
}
private async void BoldButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('bold')");
}
private async void ItalicButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('italic')");
}
private async void UnderlineButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('underline')");
}
private async void StrokeButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('strikethrough')");
}
private async void BulletListButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('insertunorderedlist')");
}
private async void OrderedListButtonClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('insertorderedlist')");
}
private async void IncreaseIndentClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('indent')");
}
private async void DecreaseIndentClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("editor.execCommand('outdent')");
}
private async void AlignmentChanged(object sender, SelectionChangedEventArgs e)
{
var selectedItem = AlignmentListView.SelectedItem as ComboBoxItem;
var alignment = selectedItem.Tag.ToString();
switch (alignment)
{
case "left":
await InvokeScriptSafeAsync("editor.execCommand('justifyleft')");
break;
case "center":
await InvokeScriptSafeAsync("editor.execCommand('justifycenter')");
break;
case "right":
await InvokeScriptSafeAsync("editor.execCommand('justifyright')");
break;
case "justify":
await InvokeScriptSafeAsync("editor.execCommand('justifyfull')");
break;
}
}
public async Task<string> ExecuteScriptFunctionAsync(string functionName, params object[] parameters)
{
string script = functionName + "(";
for (int i = 0; i < parameters.Length; i++)
{
script += JsonSerializer.Serialize(parameters[i]);
if (i < parameters.Length - 1)
{
script += ", ";
}
}
script += ");";
return await Chromium.ExecuteScriptAsync(script);
}
private async Task<string> InvokeScriptSafeAsync(string function)
{
if (Chromium == null) return string.Empty;
try
{
return await Chromium.ExecuteScriptAsync(function);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return string.Empty;
}
private async void AddImageClicked(object sender, RoutedEventArgs e)
{
await InvokeScriptSafeAsync("imageInput.click();");
}
private async Task FocusEditorAsync()
{
await InvokeScriptSafeAsync("editor.selection.focus();");
Chromium.Focus(FocusState.Keyboard);
Chromium.Focus(FocusState.Programmatic);
}
private async void EmojiButtonClicked(object sender, RoutedEventArgs e)
{
CoreInputView.GetForCurrentView().TryShow(CoreInputViewKind.Emoji);
await FocusEditorAsync();
}
private async Task<string> TryGetSelectedTextAsync()
{
try
{
return await Chromium.ExecuteScriptAsync("getSelectedText();");
}
catch { }
return string.Empty;
}
private async void WebViewToggleButtonClicked(object sender, RoutedEventArgs e)
{
var enable = WebviewToolBarButton.IsChecked == true ? "true" : "false";
await InvokeScriptSafeAsync($"toggleToolbar('{enable}');");
}
private async Task UpdateEditorThemeAsync()
{
await _domLoadedTask.Task;
if (IsComposerDarkMode)
{
Chromium.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Dark;
await InvokeScriptSafeAsync("SetDarkEditor();");
}
else
{
Chromium.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Light;
await InvokeScriptSafeAsync("SetLightEditor();");
}
}
private async Task RenderInternalAsync(string htmlBody)
{
await _domLoadedTask.Task;
await UpdateEditorThemeAsync();
if (string.IsNullOrEmpty(htmlBody))
{
await ExecuteScriptFunctionAsync("RenderHTML", " ");
}
else
{
await ExecuteScriptFunctionAsync("RenderHTML", htmlBody);
await FocusEditorAsync();
}
}
private async void ChromiumInitialized(Microsoft.UI.Xaml.Controls.WebView2 sender, Microsoft.UI.Xaml.Controls.CoreWebView2InitializedEventArgs args)
{
var editorBundlePath = (await _nativeAppService.GetEditorBundlePathAsync()).Replace("editor.html", string.Empty);
Chromium.CoreWebView2.SetVirtualHostNameToFolderMapping("app.editor", editorBundlePath, CoreWebView2HostResourceAccessKind.Allow);
Chromium.Source = new Uri("https://app.editor/editor.html");
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
Chromium.CoreWebView2.DOMContentLoaded += DOMLoaded;
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
Chromium.CoreWebView2.WebMessageReceived += ScriptMessageReceived;
}
private static async void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is SignatureEditorDialog dialog)
{
await dialog.UpdateEditorThemeAsync();
}
}
private void ScriptMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
{
var change = JsonSerializer.Deserialize<WebViewMessage>(args.WebMessageAsJson);
if (change.Type == "bold")
{
BoldButton.IsChecked = change.Value == "true";
}
else if (change.Type == "italic")
{
ItalicButton.IsChecked = change.Value == "true";
}
else if (change.Type == "underline")
{
UnderlineButton.IsChecked = change.Value == "true";
}
else if (change.Type == "strikethrough")
{
StrokeButton.IsChecked = change.Value == "true";
}
else if (change.Type == "ol")
{
OrderedListButton.IsChecked = change.Value == "true";
}
else if (change.Type == "ul")
{
BulletListButton.IsChecked = change.Value == "true";
}
else if (change.Type == "indent")
{
IncreaseIndentButton.IsEnabled = change.Value == "disabled" ? false : true;
}
else if (change.Type == "outdent")
{
DecreaseIndentButton.IsEnabled = change.Value == "disabled" ? false : true;
}
else if (change.Type == "alignment")
{
var parsedValue = change.Value switch
{
"jodit-icon_left" => 0,
"jodit-icon_center" => 1,
"jodit-icon_right" => 2,
"jodit-icon_justify" => 3,
_ => 0
};
AlignmentListView.SelectionChanged -= AlignmentChanged;
AlignmentListView.SelectedIndex = parsedValue;
AlignmentListView.SelectionChanged += AlignmentChanged;
}
}
private void DOMLoaded(CoreWebView2 sender, CoreWebView2DOMContentLoadedEventArgs args) => _domLoadedTask.TrySetResult(true);
private void SignatureNameTextBoxTextChanged(object sender, TextChangedEventArgs e) => IsPrimaryButtonEnabled = !string.IsNullOrWhiteSpace(SignatureNameTextBox.Text);
private void InvertComposerThemeClicked(object sender, RoutedEventArgs e) => IsComposerDarkMode = !IsComposerDarkMode;
}
}

View File

@@ -1,24 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.StoreRatingDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Wino.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:domain="using:Wino.Core.Domain"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_RateWino}"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_No}"
DefaultButton="Primary"
PrimaryButtonClick="RateClicked"
Title="{x:Bind domain:Translator.StoreRatingDialog_Title}"
Style="{StaticResource WinoDialogStyle}">
<Grid>
<StackPanel Spacing="6">
<TextBlock Text="{x:Bind domain:Translator.StoreRatingDialog_MessageFirstLine}" />
<TextBlock Text="{x:Bind domain:Translator.StoreRatingDialog_MessageSecondLine}" />
<CheckBox IsChecked="{x:Bind DontAskAgain, Mode=TwoWay}" Content="{x:Bind domain:Translator.Dialog_DontAskAgain}" />
</StackPanel>
</Grid>
</ContentDialog>

View File

@@ -1,25 +0,0 @@
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class StoreRatingDialog : ContentDialog, IStoreRatingDialog
{
public bool DontAskAgain { get; set; }
public bool RateWinoClicked { get; set; }
public StoreRatingDialog()
{
this.InitializeComponent();
}
private void RateClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
RateWinoClicked = true;
}
}
}

View File

@@ -1,99 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.SystemFolderConfigurationDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Wino.Controls"
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d"
Style="{StaticResource WinoDialogStyle}"
DefaultButton="Primary"
IsPrimaryButtonEnabled="True"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
xmlns:domain="using:Wino.Core.Domain"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_SaveConfiguration}"
PrimaryButtonClick="SaveClicked"
Closing="DialogClosing"
SecondaryButtonClick="CancelClicked"
Title="{x:Bind domain:Translator.SettingsConfigureSpecialFolders_Title}">
<ContentDialog.Resources>
<Style TargetType="ComboBox">
<Setter Property="Width" Value="100" />
</Style>
</ContentDialog.Resources>
<ScrollViewer>
<Grid RowSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource BodyTextBlockStyle}">
<Run Text="{x:Bind domain:Translator.SystemFolderConfigDialog_MessageFirstLine}" />
<LineBreak />
<LineBreak />
<Run
Text="{x:Bind domain:Translator.SystemFolderConfigDialog_MessageSecondLine}"
Foreground="{StaticResource SystemErrorTextColor}"
FontWeight="SemiBold" />
</TextBlock>
<StackPanel Grid.Row="1" Spacing="6">
<controls1:SettingsCard
x:Name="SentCard"
Header="{x:Bind domain:Translator.SystemFolderConfigDialog_SentFolderHeader}"
Description="{x:Bind domain:Translator.SystemFolderConfigDialog_SentFolderDescription}">
<controls1:SettingsCard.HeaderIcon>
<controls:WinoFontIcon FontSize="16" Icon="SpecialFolderSent" />
</controls1:SettingsCard.HeaderIcon>
<ComboBox SelectedItem="{x:Bind Sent, Mode=TwoWay}" ItemsSource="{x:Bind AvailableFolders}" />
</controls1:SettingsCard>
<controls1:SettingsCard
x:Name="DraftCard"
Header="{x:Bind domain:Translator.SystemFolderConfigDialog_DraftFolderHeader}"
Description="{x:Bind domain:Translator.SystemFolderConfigDialog_DraftFolderDescription}">
<controls1:SettingsCard.HeaderIcon>
<controls:WinoFontIcon FontSize="16" Icon="SpecialFolderDraft" />
</controls1:SettingsCard.HeaderIcon>
<ComboBox SelectedItem="{x:Bind Draft, Mode=TwoWay}" ItemsSource="{x:Bind AvailableFolders}" />
</controls1:SettingsCard>
<controls1:SettingsCard
x:Name="ArchiveCard"
Header="{x:Bind domain:Translator.SystemFolderConfigDialog_ArchiveFolderHeader}"
Description="{x:Bind domain:Translator.SystemFolderConfigDialog_ArchiveFolderDescription}">
<controls1:SettingsCard.HeaderIcon>
<controls:WinoFontIcon FontSize="16" Icon="SpecialFolderArchive" />
</controls1:SettingsCard.HeaderIcon>
<ComboBox SelectedItem="{x:Bind Archive, Mode=TwoWay}" ItemsSource="{x:Bind AvailableFolders}" />
</controls1:SettingsCard>
<controls1:SettingsCard
x:Name="DeletedCard"
Header="{x:Bind domain:Translator.SystemFolderConfigDialog_DeletedFolderHeader}"
Description="{x:Bind domain:Translator.SystemFolderConfigDialog_DeletedFolderDescription}">
<controls1:SettingsCard.HeaderIcon>
<controls:WinoFontIcon FontSize="16" Icon="SpecialFolderDeleted" />
</controls1:SettingsCard.HeaderIcon>
<ComboBox SelectedItem="{x:Bind Trash, Mode=TwoWay}" ItemsSource="{x:Bind AvailableFolders}" />
</controls1:SettingsCard>
<controls1:SettingsCard
x:Name="JunkCard"
Header="{x:Bind domain:Translator.SystemFolderConfigDialog_JunkFolderHeader}"
Description="{x:Bind domain:Translator.SystemFolderConfigDialog_JunkFolderDescription}">
<controls1:SettingsCard.HeaderIcon>
<controls:WinoFontIcon FontSize="16" Icon="SpecialFolderJunk" />
</controls1:SettingsCard.HeaderIcon>
<ComboBox SelectedItem="{x:Bind Junk, Mode=TwoWay}" ItemsSource="{x:Bind AvailableFolders}" />
</controls1:SettingsCard>
<TextBlock x:Name="ValidationErrorTextBlock" Foreground="{StaticResource SystemErrorTextColor}" />
</StackPanel>
</Grid>
</ScrollViewer>
</ContentDialog>

View File

@@ -1,74 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class SystemFolderConfigurationDialog : ContentDialog
{
private bool canDismissDialog = false;
public SystemFolderConfiguration Configuration { get; set; }
public List<MailItemFolder> AvailableFolders { get; }
public MailItemFolder Sent { get; set; }
public MailItemFolder Draft { get; set; }
public MailItemFolder Archive { get; set; }
public MailItemFolder Junk { get; set; }
public MailItemFolder Trash { get; set; }
public SystemFolderConfigurationDialog(List<MailItemFolder> availableFolders)
{
InitializeComponent();
AvailableFolders = availableFolders;
Sent = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Sent);
Draft = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Draft);
Archive = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Archive);
Junk = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Junk);
Trash = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Deleted);
}
private void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
{
args.Cancel = !canDismissDialog;
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
=> canDismissDialog = true;
private void SaveClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
ValidationErrorTextBlock.Text = string.Empty;
var allSpecialFolders = new List<MailItemFolder>()
{
Sent, Draft, Archive, Trash, Junk
};
if (allSpecialFolders.Any(a => a != null && a.SpecialFolderType == SpecialFolderType.Inbox))
ValidationErrorTextBlock.Text = Translator.SystemFolderConfigDialogValidation_InboxSelected;
if (new HashSet<Guid>(allSpecialFolders.Where(a => a != null).Select(x => x.Id)).Count != allSpecialFolders.Where(a => a != null).Count())
ValidationErrorTextBlock.Text = Translator.SystemFolderConfigDialogValidation_DuplicateSystemFolders;
// Check if we can save.
if (string.IsNullOrEmpty(ValidationErrorTextBlock.Text))
{
var configuration = new SystemFolderConfiguration(Sent, Draft, Archive, Trash, Junk);
canDismissDialog = true;
Configuration = configuration;
}
}
}
}

View File

@@ -1,28 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.TextInputDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource WinoDialogStyle}"
DefaultButton="Primary"
HorizontalContentAlignment="Stretch"
xmlns:domain="using:Wino.Core.Domain"
PrimaryButtonClick="UpdateOrCreateClicked"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
SecondaryButtonClick="CancelClicked"
VerticalContentAlignment="Stretch"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMinWidth">400</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">400</x:Double>
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
</ContentDialog.Resources>
<StackPanel Spacing="12">
<TextBlock x:Name="DialogDescription" TextWrapping="Wrap" />
<TextBox x:Name="FolderTextBox" Text="{x:Bind CurrentInput, Mode=TwoWay}" />
</StackPanel>
</ContentDialog>

View File

@@ -1,51 +0,0 @@
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class TextInputDialog : ContentDialog
{
public bool? HasInput { get; set; }
public string CurrentInput
{
get { return (string)GetValue(CurrentInputProperty); }
set { SetValue(CurrentInputProperty, value); }
}
public static readonly DependencyProperty CurrentInputProperty = DependencyProperty.Register(nameof(CurrentInput), typeof(string), typeof(TextInputDialog), new PropertyMetadata(string.Empty));
public TextInputDialog()
{
InitializeComponent();
}
public void SetDescription(string description)
{
DialogDescription.Text = description;
}
public void SetPrimaryButtonText(string text)
{
PrimaryButtonText = text;
}
private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Hide();
}
private void UpdateOrCreateClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
HasInput = true;
Hide();
}
}
}

View File

@@ -1,25 +0,0 @@
<ContentDialog
x:Class="Wino.Dialogs.WinoMessageDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{x:Bind DialogTitle, Mode=OneWay}"
xmlns:domain="using:Wino.Core.Domain"
Style="{StaticResource WinoDialogStyle}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
CloseButtonText="{x:Bind domain:Translator.Buttons_Close}"
DefaultButton="Close"
Closed="DialogClosed"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMinWidth">250</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">900</x:Double>
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
</ContentDialog.Resources>
<TextBlock Text="{x:Bind Message, Mode=OneWay}" TextWrapping="Wrap" />
</ContentDialog>

View File

@@ -1,65 +0,0 @@
using System.Threading.Tasks;
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Dialogs
{
public sealed partial class WinoMessageDialog : ContentDialog
{
private TaskCompletionSource<bool> _completionSource;
#region Dependency Properties
public string DialogTitle
{
get { return (string)GetValue(DialogTitleProperty); }
set { SetValue(DialogTitleProperty, value); }
}
public static readonly DependencyProperty DialogTitleProperty = DependencyProperty.Register(nameof(DialogTitle), typeof(string), typeof(ConfirmationDialog), new PropertyMetadata(string.Empty));
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(nameof(Message), typeof(string), typeof(ConfirmationDialog), new PropertyMetadata(string.Empty));
#endregion
public WinoMessageDialog()
{
InitializeComponent();
}
public async Task<bool> ShowDialogAsync(string title, string message)
{
_completionSource = new TaskCompletionSource<bool>();
DialogTitle = title;
Message = message;
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
ShowAsync();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
return await _completionSource.Task;
}
private void ApproveClicked(object sender, RoutedEventArgs e)
{
Hide();
}
private void DialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
_completionSource.TrySetResult(true);
}
}
}