Skip to content

Commit

Permalink
Some code refaction and styling of UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanDeveloper committed Jun 23, 2017
1 parent ecea9ec commit eb6f33d
Show file tree
Hide file tree
Showing 32 changed files with 142 additions and 45 deletions.
4 changes: 1 addition & 3 deletions LigaManagerAdminClient/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows;
using LigaManagerAdminClient.Controllers;
using LigaManagerAdminClient.Views;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ protected void ExecuteBackCommand(object obj)

protected abstract void ReloadModels();


/// <summary>
/// Updates the models if bool is true, otherwise an error message occur.
/// </summary>
/// <param name="isUpdated"></param>
/// <param name="errorMessage"></param>
/// <param name="errorHeader"></param>
protected void UpdateModels(bool isUpdated, string errorMessage, string errorHeader)
{
if (isUpdated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public Bettor ShowBettor()
return _view.ShowDialog() == true ? _viewModel.Bettor : null;
}

#region Execute Commands
public void ExecuteOkCommand(object obj)
{
if (_view.FirstnameTextBox.Text.Equals(string.Empty) ||
Expand All @@ -48,5 +49,6 @@ public void ExecuteCancelCommand(object obj)
_view.DialogResult = false;
_view.Close();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Match ShowMatch()

return _view.ShowDialog() == true ? _viewModel.SelectedMatch : null;
}

#region Execute Commands
public void ExecuteOkCommand(object obj)
{
if (_view.AwayTeamComboBox.SelectedValue == null ||
Expand All @@ -66,5 +66,6 @@ public void ExecuteCancelCommand(object obj)
_view.DialogResult = false;
_view.Close();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Season ShowSeason()

return _view.ShowDialog() == true ? _viewModel.Season : null;
}

#region Execute Commands
public void ExecuteOkCommand(object obj)
{
if (_view.NameTextBox.Text.Equals(string.Empty))
Expand All @@ -46,5 +46,6 @@ public void ExecuteCancelCommand(object obj)
_view.DialogResult = false;
_view.Close();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Team ShowTeam()

return _view.ShowDialog() == true ? _viewModel.Team : null;
}

#region Execute Commands
public void ExecuteOkCommand(object obj)
{
if (_view.NameTextBox.Text.Equals(string.Empty))
Expand All @@ -50,5 +50,6 @@ public void ExecuteCancelCommand(object obj)
_view.DialogResult = false;
_view.Close();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ protected override async void ExecuteChangeCommand(object obj)

var showBettor = addBettorWindow.ShowBettor();
// it could be possible that the bettor is null
if (showBettor == null) return;
if (showBettor == null)
{
ReloadModels();
return;
}
// Check if service is available
if (!await AdminClientHelper.IsAvailable(_adminClient)) return;
// add bettor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ protected override async void ExecuteChangeCommand(object obj)

var showMatch = addBettorWindow.ShowMatch();
// it could be possible that the bettor is null
if (showMatch == null) return;
if (showMatch == null)
{
ReloadModels();
return;
}
// Check if service is available
if (!await AdminClientHelper.IsAvailable(_adminClient)) return;
// add bettor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ protected override async void ExecuteChangeCommand(object obj)

var showSeason = addSeasonWindow.ShowSeason();
// it could be possible that the bettor is null
if (showSeason == null) return;
if (showSeason == null)
{
ReloadModels();
return;
}
// Check if service is available
if (!await AdminClientHelper.IsAvailable(_adminClient)) return;
// add bettor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ protected override async void ExecuteChangeCommand(object obj)

var showTeam = addBettorWindow.ShowTeam();
// it could be possible that the bettor is null
if (showTeam == null) return;
if (showTeam == null)
{
ReloadModels();
return;
}
// Check if service is available
if (!await AdminClientHelper.IsAvailable(_adminClient)) return;
// add bettor
Expand Down
Binary file added LigaManagerAdminClient/Data/Images/calendar-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LigaManagerAdminClient/Data/Images/group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed LigaManagerAdminClient/Data/Images/id-card-5.png
Binary file not shown.
Binary file modified LigaManagerAdminClient/Data/Images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions LigaManagerAdminClient/LigaManagerAdminClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@
<ItemGroup>
<Resource Include="Data\Images\edit.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\id-card-5.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\left-arrow.png" />
</ItemGroup>
Expand All @@ -297,14 +294,17 @@
<Resource Include="Data\Images\success.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\group.png" />
<Resource Include="Data\Images\football.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\football.png" />
<Resource Include="Data\Images\calendar-5.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\user.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\group.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
6 changes: 3 additions & 3 deletions LigaManagerAdminClient/Views/AddBettorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<Image Source="/LigaManagerAdminClient;component/Data/Images/success.png" Height="31" Width="41" />
</StackPanel>
</Button>
<TextBox x:Name="NicknameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding Bettor.Nickname, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" VerticalAlignment="Top" Width="172" />
<TextBox x:Name="FirstnameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="{Binding Bettor.Firstname}" VerticalAlignment="Top" Width="172"/>
<TextBox x:Name="LastnameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="{Binding Bettor.Lastname}" VerticalAlignment="Top" Width="172"/>
<TextBox x:Name="NicknameTextBox" TextChanged="OnTextChangedNickname" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding Bettor.Nickname, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" VerticalAlignment="Top" Width="172" />
<TextBox x:Name="FirstnameTextBox" Grid.Column="1" TextChanged="OnTextChanged" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="{Binding Bettor.Firstname}" VerticalAlignment="Top" Width="172"/>
<TextBox x:Name="LastnameTextBox" Grid.Column="1" TextChanged="OnTextChanged" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="{Binding Bettor.Lastname}" VerticalAlignment="Top" Width="172"/>
<Label Content="Nickname" HorizontalAlignment="Left" Margin="10,8,0,0" Grid.Row="1" Grid.Column="0"
VerticalAlignment="Top" Width="80" Height="26"/>
<Label Content="Vorname" HorizontalAlignment="Left" Margin="10,8,0,0" Grid.Row="2" Grid.Column="0"
Expand Down
19 changes: 19 additions & 0 deletions LigaManagerAdminClient/Views/AddBettorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -23,5 +24,23 @@ public AddBettorWindow()
{
InitializeComponent();
}

private void OnTextChangedNickname(object sender, TextChangedEventArgs e)
{
var textBox = (TextBox)sender;
if (textBox.Text != string.Empty && !Regex.IsMatch(textBox.Text, @"^[0-9a-zA-Z\.]+$"))
{
textBox.Text = textBox.Text.Remove(textBox.Text.Length - 1);
}
}

private void OnTextChanged(object sender, TextChangedEventArgs e)
{
var textBox = (TextBox)sender;
if (textBox.Text != string.Empty && !Regex.IsMatch(textBox.Text, @"^[a-zA-Z\.]+$"))
{
textBox.Text = textBox.Text.Remove(textBox.Text.Length - 1);
}
}
}
}
2 changes: 1 addition & 1 deletion LigaManagerAdminClient/Views/MenuWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<Button Command="{Binding SeasonCommand}" ToolTip="Zur Saisonübersicht" HorizontalAlignment="Left" Margin="30,20,0,0" Grid.Row="3" Grid.Column="0"
VerticalAlignment="Top" Width="125" Height="70">
<StackPanel>
<Image Source="/LigaManagerAdminClient;component/Data/Images/group.png" Height="65" Width="86" />
<Image Source="/LigaManagerAdminClient;component/Data/Images/calendar-5.png" Height="65" Width="86" />
</StackPanel>
</Button>
<Button Command="{Binding TeamCommand}" ToolTip="Zur Teamübersicht" HorizontalAlignment="Left" Margin="30,20,0,0" Grid.Row="4" Grid.Column="0"
Expand Down
Binary file added LigaManagerBettorClient/Data/Images/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LigaManagerBettorClient/Data/Images/football.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LigaManagerBettorClient/Data/Images/group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LigaManagerBettorClient/Data/Images/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LigaManagerBettorClient/Data/Images/trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LigaManagerBettorClient/Data/Images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions LigaManagerBettorClient/LigaManagerBettorClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,24 @@
<ItemGroup>
<Resource Include="Data\Images\left-arrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\football.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\success.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\error.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\trash.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\user.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Data\Images\group.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.2.1.0\build\netstandard1.0\Fody.targets" Condition="Exists('..\packages\Fody.2.1.0\build\netstandard1.0\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
7 changes: 6 additions & 1 deletion LigaManagerBettorClient/Views/BettorRankingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
</DataGrid>
<ComboBox ItemsSource="{Binding MatchDays}" SelectedItem="{Binding SelectedMatchDay}" x:Name="MatchDayComboBox" Grid.Row="0" HorizontalAlignment="Left" Margin="575,63,0,0" VerticalAlignment="Top" Width="165" Height="26"/>
<Label Grid.Row="0" Content="Spieltag" HorizontalAlignment="Left" Margin="520,63,0,0" VerticalAlignment="Top" Width="85"/>
<Button Command="{Binding BackCommand}" Content="Zurück" HorizontalAlignment="Left" Margin="10,25,0,0" Grid.Row="2" VerticalAlignment="Top" Width="80"/>
<Button Command="{Binding BackCommand}" ToolTip="Zurück" HorizontalAlignment="Left" Margin="20,5,0,0" VerticalAlignment="Top" Width="60" Height="40"
Grid.Row="2" Grid.Column="0">
<StackPanel>
<Image Source="/LigaManagerBettorClient;component/Data/Images/left-arrow.png" Height="31" Width="41" />
</StackPanel>
</Button>
</Grid>
</Page>
15 changes: 12 additions & 3 deletions LigaManagerBettorClient/Views/DetailMatchWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Icon="../Data/Images/football.png"
Title="DetailMatchWindow" Height="600" Width="600" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
Expand All @@ -21,16 +22,24 @@
<Label Content="Am" FontSize="18" HorizontalAlignment="Left" Margin="20,20,0,0" Grid.Row="1" VerticalAlignment="Top" Height="34" Width="37"/>
<TextBlock HorizontalAlignment="Left" FontSize="18" Margin="85,25,0,0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding Match.DateTime, StringFormat=dd.MM.yyyy HH:mm}" VerticalAlignment="Top" Width="235" Height="24"/>
<Button x:Name="BetButton" Command="{Binding BetCommand}" Content="Tipp abgeben" HorizontalAlignment="Left" Margin="10,20,0,0" Grid.Row="5" VerticalAlignment="Top" Width="100" Height="50"/>
<Button Content="Abbrechen" Command="{Binding CancelCommand}" HorizontalAlignment="Right" Margin="0,20,10,0" Grid.Row="5" VerticalAlignment="Top" Width="175" Height="50"/>
<Button ToolTip="Abbrechen" Command="{Binding CancelCommand}" HorizontalAlignment="Right" Margin="0,20,10,0" Grid.Row="5" VerticalAlignment="Top" Width="175" Height="50">
<StackPanel>
<Image Source="/LigaManagerBettorClient;component/Data/Images/error.png" Height="44" Width="58" />
</StackPanel>
</Button>
<Label Content="Tipp" FontSize="24" HorizontalAlignment="Left" Margin="10,25,0,0" VerticalAlignment="Top" Height="45" Width="70" Grid.Row="3"/>
<Label Content="Ergebnis" FontSize="18" HorizontalAlignment="Left" Margin="20,25,0,0" Grid.Row="2" VerticalAlignment="Top" Height="34" Width="78" Grid.RowSpan="2"/>
<TextBlock x:Name="HomeTeamScoreTextBlock" FontWeight="Bold" TextAlignment="Center" HorizontalAlignment="Left" FontSize="18" Text="{Binding Match.HomeTeamScore}" Height="23" Margin="140,30,0,0" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBlock x:Name="AwayTeamScoreTextBlock" FontWeight="Bold" TextAlignment="Center" HorizontalAlignment="Left" FontSize="18" Text="{Binding Match.AwayTeamScore}" Height="23" Margin="400,29,0,0" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="HomeTeamBet" Text="{Binding Bet.HomeTeamScore}" TextChanged="OnTextChanged" TextAlignment="Center" HorizontalAlignment="Left" Height="23" Margin="85,53,0,0" Grid.Row="4" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="AwayTeamBet" Text="{Binding Bet.AwayTeamScore}" TextChanged="OnTextChanged" TextAlignment="Center" HorizontalAlignment="Left" Height="23" Margin="330,53,0,0" Grid.Row="4" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<Label Content="Geändert am " HorizontalAlignment="Left" Margin="0,134,0,0" Grid.Row="4" VerticalAlignment="Top" Height="26" Width="82"/>

<TextBlock HorizontalAlignment="Left" Margin="75,139,0,0" Grid.Row="4" TextWrapping="Wrap" Text="{Binding Bet.DateTime, StringFormat=dd.MM.yyyy HH:mm}" VerticalAlignment="Top" Height="16" Width="165"/>
<Button x:Name="DeleteBetButton" Command="{Binding DeleteBetCommand}" Content="Tipp löschen" HorizontalAlignment="Left" Margin="125,20,0,0" Grid.Row="5" VerticalAlignment="Top" Width="100" Height="50"/>
<Button x:Name="DeleteBetButton" Command="{Binding DeleteBetCommand}" ToolTip="Tipp löschen" HorizontalAlignment="Left" Margin="125,20,0,0" Grid.Row="5" VerticalAlignment="Top" Width="100" Height="50">
<StackPanel>
<Image Source="/LigaManagerBettorClient;component/Data/Images/trash.png" Height="44" Width="58" />
</StackPanel>
</Button>
</Grid>
</Window>
1 change: 0 additions & 1 deletion LigaManagerBettorClient/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LigaManagerBettorClient.Views"
mc:Ignorable="d"
Title="Liga Manager" Height="600" Width="800">
<Grid>
Expand Down
16 changes: 11 additions & 5 deletions LigaManagerBettorClient/Views/MatchesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>
<Button Command="{Binding SelectedMatchCommand}" HorizontalAlignment="Left" Margin="730,10,0,0" VerticalAlignment="Top" Width="40" Grid.Row="2" Height="40">
<Button.Background>
<ImageBrush ImageSource="pack://application:,,,/Data/Images/edit.png"/>
</Button.Background>
<Button Command="{Binding SelectedMatchCommand}" ToolTip="Ändern" HorizontalAlignment="Left" Margin="720,5,0,0" VerticalAlignment="Top" Width="60" Height="40"
Grid.Row="2" Grid.Column="0">
<StackPanel>
<Image Source="/LigaManagerBettorClient;component/Data/Images/edit.png" Height="31" Width="41" />
</StackPanel>
</Button>
<Button Command="{Binding BackCommand}" ToolTip="Zurück" HorizontalAlignment="Left" Margin="20,5,0,0" VerticalAlignment="Top" Width="60" Height="40"
Grid.Row="2" Grid.Column="0">
<StackPanel>
<Image Source="/LigaManagerBettorClient;component/Data/Images/left-arrow.png" Height="31" Width="41" />
</StackPanel>
</Button>
<Button Command="{Binding BackCommand}" Content="Zurück" HorizontalAlignment="Left" Margin="10,25,0,0" Grid.Row="2" VerticalAlignment="Top" Width="80"/>
</Grid>
</Page>
Loading

0 comments on commit eb6f33d

Please sign in to comment.