radial progressbar

This commit is contained in:
Rene Schwarz
2021-04-14 00:53:57 +02:00
parent cf7b9abcf0
commit e220c09ec3
61 changed files with 2449 additions and 262 deletions

View File

@@ -0,0 +1,65 @@
using Server_Dashboard.Views;
using System;
using System.Collections.Generic;
using System.Security;
using System.Text;
using System.Windows.Input;
namespace Server_Dashboard {
class LoginViewModel : BaseViewModel, IWindowHelper {
private string username;
public string Username {
get { return username; }
set {
if (username != value)
username = value;
OnPropertyChanged(nameof(username));
}
}
private string errorText;
public string ErrorText {
get { return errorText; }
set {
if (errorText != value)
errorText = value;
OnPropertyChanged(nameof(errorText));
}
}
public Action Close { get ; set; }
public LoginViewModel() {
LoginCommand = new RelayCommand(Login);
}
public ICommand LoginCommand { get; set; }
private void Login(object parameter) {
if (!String.IsNullOrWhiteSpace(Username) && !String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) {
if (DatabaseHandler.CheckLogin(Username, (parameter as IHavePassword).SecurePassword.Unsecure())) {
DashboardWindow window = new DashboardWindow();
window.Show();
Close?.Invoke();
} else {
ErrorText = "Username or password is wrong.";
return;
}
} else if (String.IsNullOrWhiteSpace(Username) && String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) {
ErrorText = "Please provide a username and password";
return;
}
if (String.IsNullOrWhiteSpace(Username)) {
ErrorText = "Username cannot be empty.";
return;
}
if (String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) {
ErrorText = "Password cannot be empty.";
return;
}
ErrorText = "";
}
}
}