Sender name implementation.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user