Pass account info to login dialogs

This commit is contained in:
Robert McRackan 2020-08-28 13:55:03 -04:00
parent a12391f0ab
commit d24c10ddf5
5 changed files with 18 additions and 8 deletions

View file

@ -31,7 +31,7 @@ namespace LibationWinForms.Dialogs
try
{
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.ImportAccountAsync(new WinformResponder(), _accounts);
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.ImportAccountAsync((account) => new WinformResponder(account), _accounts);
}
catch
{

View file

@ -1,10 +1,19 @@
using System;
using AudibleApi;
using InternalUtilities;
using LibationWinForms.Dialogs.Login;
namespace LibationWinForms.Login
{
public class WinformResponder : AudibleApi.ILoginCallback
public class WinformResponder : ILoginCallback
{
private Account _account { get; }
public WinformResponder(Account account)
{
_account = Dinah.Core.ArgumentValidator.EnsureNotNull(account, nameof(account));
}
public string Get2faCode()
{
using var dialog = new _2faCodeDialog();