added login logic and text

This commit is contained in:
shinichi
2020-10-07 15:14:39 +02:00
parent 6e2b3a80b3
commit 6159f3f57b
3 changed files with 27 additions and 14 deletions

View File

@@ -1,11 +1,26 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Text; using System.Text;
using System.Windows.Controls;
using System.Windows.Input;
using ClientApp.Utils; using ClientApp.Utils;
using GalaSoft.MvvmLight.Command;
namespace ClientApp.ViewModels namespace ClientApp.ViewModels
{ {
class LoginViewModel : ObservableObject class LoginViewModel : ObservableObject
{ {
public string Username { get; set; }
public LoginViewModel()
{
LoginCommand = new RelayCommand<object>((parameter) =>
{
Debug.WriteLine($"username {Username} password {((PasswordBox)parameter).Password}");
//TODO send username and password to server
});
}
public ICommand LoginCommand { get; set; }
} }
} }

View File

@@ -6,13 +6,13 @@
xmlns:local="clr-namespace:ClientApp.Views" xmlns:local="clr-namespace:ClientApp.Views"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <DockPanel>
<StackPanel VerticalAlignment="Center"> <StackPanel VerticalAlignment="Center" Width="auto">
<Label Content="Username" HorizontalContentAlignment="Center"/> <Label Content="Username" HorizontalContentAlignment="Center" />
<TextBox x:Name="Username" TextWrapping="Wrap" Width="120"/> <TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120"/>
<Label Content="Password" HorizontalContentAlignment="Center"/> <Label Content="Password" HorizontalContentAlignment="Center"/>
<TextBox x:Name="Password" TextWrapping="Wrap" Width="120"/> <PasswordBox x:Name="Password" Width="120"/>
<Button x:Name="Login" Content="Login" Margin="0,20,0,0" Width="120"/> <Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
</StackPanel> </StackPanel>
</Grid> </DockPanel>
</UserControl> </UserControl>

View File

@@ -6,13 +6,11 @@
xmlns:local="clr-namespace:ClientApp" xmlns:local="clr-namespace:ClientApp"
xmlns:views="clr-namespace:ClientApp.Views" xmlns:views="clr-namespace:ClientApp.Views"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"> Title="Whaazzzzuuuuuuuup" Height="450" Width="800">
<Grid> <DockPanel>
<Label Content="gemaakt door: mensen" DockPanel.Dock="Bottom" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontStyle="Italic" Foreground="Gray"/>
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="{Binding SelectedViewModel}" />
<ContentControl DockPanel.Dock="Bottom" Content="{Binding SelectedViewModel}" /> </DockPanel>
</Grid>
</Window> </Window>