Sender name implementation.

This commit is contained in:
Burak Kaan Köse
2024-06-07 23:58:51 +02:00
parent 52140c3208
commit 641bfd8c06
15 changed files with 581 additions and 59 deletions

View File

@@ -42,22 +42,32 @@
</DataTemplate>
</ContentDialog.Resources>
<Grid MinWidth="400">
<Grid MinWidth="400" RowSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Info panel -->
<!-- Account Name -->
<TextBox
x:Name="AccountNameTextbox"
Header="{x:Bind domain:Translator.NewAccountDialog_AccountName}"
Text="{x:Bind domain:Translator.NewAccountDialog_AccountNameDefaultValue}"
PlaceholderText="{x:Bind domain:Translator.NewAccountDialog_AccountNamePlaceholder}"
TextChanged="AccountNameChanged" />
<!-- TODO -->
<!-- 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" />

View File

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Accounts;
@@ -25,7 +23,7 @@ namespace Wino.Dialogs
public List<IProviderDetail> Providers { get; set; }
public Tuple<string, MailProviderType> AccountInformationTuple = null;
public AccountCreationDialogResult Result = null;
public NewAccountDialog()
{
@@ -51,22 +49,21 @@ namespace Wino.Dialogs
if (IsSecondaryButtonEnabled)
{
AccountInformationTuple = new Tuple<string, MailProviderType>(AccountNameTextbox.Text.Trim(), SelectedMailProvider.Type);
Result = new AccountCreationDialogResult(SelectedMailProvider.Type, AccountNameTextbox.Text.Trim(), SenderNameTextbox.Text.Trim());
Hide();
}
}
private void AccountNameChanged(object sender, TextChangedEventArgs e)
{
ValidateCreateButton();
}
private void AccountNameChanged(object sender, TextChangedEventArgs e) => ValidateCreateButton();
private void SenderNameChanged(object sender, TextChangedEventArgs e) => ValidateCreateButton();
// Returns whether we can create account or not.
private void ValidateCreateButton()
{
bool shouldEnable = SelectedMailProvider != null
&& SelectedMailProvider.IsSupported
&& !string.IsNullOrEmpty(AccountNameTextbox.Text);
&& !string.IsNullOrEmpty(AccountNameTextbox.Text)
&& !string.IsNullOrWhiteSpace(SenderNameTextbox.Text);
IsPrimaryButtonEnabled = shouldEnable;
}

View File

@@ -12,6 +12,7 @@ using Wino.Core.Domain;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Accounts;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.Synchronization;
using Wino.Core.Messages.Shell;
@@ -108,7 +109,7 @@ namespace Wino.Services
return await HandleDialogPresentation(() => dialog.ShowDialogAsync(title, question, confirmationButtonTitle));
}
public async Task<Tuple<string, MailProviderType>> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders)
public async Task<AccountCreationDialogResult> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders)
{
var dialog = new NewAccountDialog
{
@@ -118,7 +119,7 @@ namespace Wino.Services
await HandleDialogPresentationAsync(dialog);
return dialog.AccountInformationTuple;
return dialog.Result;
}
public IAccountCreationDialog GetAccountCreationDialog(MailProviderType type)

View File

@@ -6,8 +6,8 @@ using Microsoft.AppCenter.Analytics;
using Microsoft.Extensions.DependencyInjection;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.AutoDiscovery;
using Wino.Core.Messages.Mails;

View File

@@ -28,7 +28,7 @@
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>arm64</AppxBundlePlatforms>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
@@ -880,4 +880,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>