-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
373 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleSteamLoginPageViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using BD.SteamClient.Models; | ||
using BD.SteamClient.Services; | ||
|
||
namespace BD.WTTS.UI.ViewModels; | ||
|
||
public sealed partial class IdleSteamLoginPageViewModel : WindowViewModel | ||
{ | ||
readonly ISteamAccountService Account = Ioc.Get<ISteamAccountService>(); | ||
|
||
public SteamLoginState SteamLoginState { get; set; } | ||
|
||
public IdleSteamLoginPageViewModel(ref SteamLoginState steamLoginState) | ||
{ | ||
SteamLoginState = steamLoginState; | ||
this.Login = ReactiveCommand.Create(SteamLogin); | ||
} | ||
|
||
private async void SteamLogin() | ||
{ | ||
if (!IsLoading) | ||
{ | ||
IsLoading = true; | ||
|
||
if (SteamLoginState.SteamId == 0) | ||
{ | ||
SteamLoginState.Username = UserNameText; | ||
SteamLoginState.Password = PasswordText; | ||
} | ||
else | ||
{ | ||
this.TwofactorCode ??= string.Empty; | ||
|
||
if (SteamLoginState.Requires2FA) | ||
{ | ||
SteamLoginState.TwofactorCode = this.TwofactorCode; | ||
} | ||
else if (SteamLoginState.RequiresEmailAuth) | ||
{ | ||
SteamLoginState.EmailCode = this.TwofactorCode; | ||
} | ||
} | ||
|
||
await Account.DoLoginV2Async(SteamLoginState); | ||
|
||
Requires2FA = SteamLoginState.Requires2FA; | ||
RequiresEmailAuth = SteamLoginState.RequiresEmailAuth; | ||
|
||
if (SteamLoginState.Success) | ||
{ | ||
if (RemenberLogin) | ||
{ | ||
|
||
} | ||
Toast.Show(ToastIcon.Success, Strings.Success_.Format(Strings.User_Login)); | ||
IsLoading = false; | ||
Close?.Invoke(); | ||
} | ||
else if (SteamLoginState.Message != null) | ||
{ | ||
IsLoading = false; | ||
Toast.Show(ToastIcon.Warning, SteamLoginState.Message); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleSteamLoginViewModel.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.