[FIX] made login impossible if no name was entered
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
<Label Grid.Row="2" FontSize="15" Content="(max amount of characters for the username is 10)"/>
|
<Label Grid.Row="2" FontSize="15" Content="(max amount of characters for the username is 10)"/>
|
||||||
|
|
||||||
<TextBox Name="usernameTextbox" Grid.Row="1" Grid.Column="1" MaxLength="69" FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Left" Width="250"/>
|
<TextBox Name="usernameTextbox" Grid.Row="1" Grid.Column="1" MaxLength="69" FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Left" Width="250"/>
|
||||||
<Button Content="ENTER" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Width="100" Height="40" Click="Button_EnterUsername"/>
|
<Button Name="LoginButton" Content="ENTER" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Width="100" Height="40" Click="Button_EnterUsername"/>
|
||||||
|
|
||||||
<Label Grid.Row="3" Grid.Column="0" Content="Tip of the century: base64 != UTF8!" FontSize="20" FontWeight="Bold"/>
|
<Label Grid.Row="3" Grid.Column="0" Content="Tip of the century: base64 != UTF8!" FontSize="20" FontWeight="Bold"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -27,9 +27,12 @@ namespace Client.Views
|
|||||||
|
|
||||||
private void Button_EnterUsername(object sender, RoutedEventArgs e)
|
private void Button_EnterUsername(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
User user = new User(usernameTextbox.Text);
|
string name = usernameTextbox.Text;
|
||||||
|
if (name == string.Empty) return;
|
||||||
|
User user = new User(name);
|
||||||
|
|
||||||
Client client = new Client(user.Username);
|
Client client = new Client(user.Username);
|
||||||
loginButton.IsEnabled = false;
|
LoginButton.IsEnabled = false;
|
||||||
client.OnSuccessfullConnect = () =>
|
client.OnSuccessfullConnect = () =>
|
||||||
{
|
{
|
||||||
// because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread
|
// because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread
|
||||||
|
|||||||
Reference in New Issue
Block a user