forked from Roflin/gamenight
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Threading.Tasks;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Gamenight.Ui.Services;
|
|
using ReactiveUI;
|
|
using ReactiveUI.SourceGenerators;
|
|
|
|
namespace Gamenight.Ui.ViewModels;
|
|
|
|
public partial class MainViewModel : ReactiveObject
|
|
{
|
|
[ObservableAsProperty]
|
|
private string _greeting = "Welcome to Avalonia!";
|
|
private IGamenightApi GamenightApi { get; }
|
|
public HeaderViewModel HeaderViewModel { get; }
|
|
public SideBarViewModel SideBarViewModel { get; }
|
|
|
|
[ObservableAsProperty]
|
|
private IReactiveCommand _loginCommand;
|
|
|
|
[ObservableAsProperty]
|
|
private IScreen _screen;
|
|
|
|
public MainViewModel(IGamenightApi gamenightApi, IScreen screen, HeaderViewModel headerViewModel, SideBarViewModel sideBarViewModel)
|
|
{
|
|
GamenightApi = gamenightApi;
|
|
_screen = screen;
|
|
|
|
HeaderViewModel = headerViewModel;
|
|
SideBarViewModel = sideBarViewModel;
|
|
|
|
_loginCommand = ReactiveCommand.Create(Test);
|
|
}
|
|
|
|
public async Task Test() {
|
|
var token = await GamenightApi.Token(new Login() {
|
|
Username = "admin",
|
|
Password = "gamenight!"
|
|
});
|
|
|
|
System.Console.WriteLine($"Token: {token.JwtToken}");
|
|
}
|
|
}
|