login working
uuuuggglyyyyyyyyyyyyyy :(
This commit is contained in:
@@ -19,12 +19,20 @@ namespace ClientApp.ViewModels
|
||||
this.mainWindowViewModel = mainWindowViewModel;
|
||||
LoginCommand = new RelayCommand<object>((parameter) =>
|
||||
{
|
||||
Debug.WriteLine($"username {Username} password {((PasswordBox)parameter).Password}");
|
||||
//TODO send username and password to server
|
||||
this.mainWindowViewModel.SelectedViewModel = new MainViewModel();
|
||||
this.mainWindowViewModel.client.tryLogin(Username, ((PasswordBox)parameter).Password);
|
||||
});
|
||||
}
|
||||
|
||||
public ICommand LoginCommand { get; set; }
|
||||
|
||||
internal void setLoginStatus(bool status)
|
||||
{
|
||||
this.mainWindowViewModel.infoModel.ConnectedToServer = true;
|
||||
if (status)
|
||||
{
|
||||
this.mainWindowViewModel.SelectedViewModel = new MainViewModel(mainWindowViewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,23 @@ namespace ClientApp.ViewModels
|
||||
{
|
||||
class MainViewModel : ObservableObject
|
||||
{
|
||||
public Info infoModel { get; set; }
|
||||
public ICommand RetryServerCommand { get; set; }
|
||||
public ICommand RetryVREngineCommand { get; set; }
|
||||
public MainWindowViewModel MainWindowViewModel;
|
||||
|
||||
public MainViewModel()
|
||||
|
||||
public MainViewModel(MainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
this.infoModel = new Info();
|
||||
this.MainWindowViewModel = mainWindowViewModel;
|
||||
this.RetryServerCommand = new RelayCommand(() =>
|
||||
{
|
||||
//try connect server
|
||||
this.infoModel.ConnectedToServer = true;
|
||||
this.MainWindowViewModel.infoModel.ConnectedToServer = true;
|
||||
});
|
||||
this.RetryVREngineCommand = new RelayCommand(() =>
|
||||
{
|
||||
//try connect vr-engine
|
||||
this.infoModel.ConnectedToVREngine = true;
|
||||
this.MainWindowViewModel.infoModel.ConnectedToVREngine = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ClientApp.Utils;
|
||||
using ClientApp.Models;
|
||||
using ClientApp.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -7,12 +8,19 @@ namespace ClientApp.ViewModels
|
||||
{
|
||||
class MainWindowViewModel : ObservableObject
|
||||
{
|
||||
public Info infoModel { get; set; }
|
||||
|
||||
public ObservableObject SelectedViewModel { get; set; }
|
||||
public Client client { get; }
|
||||
|
||||
public MainWindowViewModel()
|
||||
public MainWindowViewModel(Client client)
|
||||
{
|
||||
SelectedViewModel = new LoginViewModel(this);
|
||||
this.infoModel = new Info();
|
||||
this.client = client;
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||
SelectedViewModel = loginViewModel;
|
||||
this.client.SetLoginViewModel(loginViewModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user