Skip to content

Commit

Permalink
add player name field to AddGameDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zeier committed Dec 3, 2015
1 parent dcd9d54 commit 5aef906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Hearthstone Deck Tracker/Windows/AddGameDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:enums="clr-namespace:Hearthstone_Deck_Tracker.Enums"
mc:Ignorable="d"
d:DesignHeight="300" Title="Add new game" Height="450" d:DesignWidth="450">
d:DesignHeight="300" Title="Add new game" Height="480" d:DesignWidth="450">
<StackPanel Width="300" Margin="0,15,0,0">
<DockPanel Margin="0,2,0,0">
<Label Content="Result:" Width="90"/>
Expand Down Expand Up @@ -84,6 +84,10 @@
<Label Content="Opponent:" Width="90"/>
<TextBox Name="TextBoxOppName" />
</DockPanel>
<DockPanel Margin="0,2,0,0">
<Label Content="Player:" Width="90"/>
<TextBox Name="TextBoxPlayerName" />
</DockPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Width="210" Margin="0,30,0,0">
<Button Name="BtnSave" Content="add game" Width="90" Style="{StaticResource AccentedSquareButtonStyle}" Click="BtnSave_OnClick"/>
<Button Content="cancel" Width="90" Margin="20,0,0,0" Click="BtnCancel_OnClick"/>
Expand Down
10 changes: 8 additions & 2 deletions Hearthstone Deck Tracker/Windows/AddGameDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ public AddGameDialog(Deck deck)
TextBoxRank.Text = lastGame.Rank.ToString();
}
}
if(lastGame != null && lastGame.Region != Region.UNKNOWN)
ComboBoxRegion.SelectedItem = lastGame.Region;
if(lastGame != null)
{
TextBoxPlayerName.Text = lastGame.PlayerName;
if(lastGame.Region != Region.UNKNOWN)
ComboBoxRegion.SelectedItem = lastGame.Region;
}
_deck = deck;
_game = new GameStats();
BtnSave.Content = "add game";
Expand Down Expand Up @@ -79,6 +83,7 @@ public AddGameDialog(GameStats game)
TextBoxDuration.IsEnabled = false;
TextBoxNote.Text = game.Note;
TextBoxOppName.Text = game.OpponentName;
TextBoxPlayerName.Text = game.PlayerName;
BtnSave.Content = "save";
}

Expand Down Expand Up @@ -108,6 +113,7 @@ private void BtnSave_OnClick(object sender, RoutedEventArgs e)
_game.Rank = rank;
_game.Note = TextBoxNote.Text;
_game.OpponentName = TextBoxOppName.Text;
_game.PlayerName = TextBoxPlayerName.Text;
_game.Turns = turns;
_game.WasConceded = (YesNo)ComboBoxConceded.SelectedValue == YesNo.Yes;
_game.Region = (Region)ComboBoxRegion.SelectedItem;
Expand Down

0 comments on commit 5aef906

Please sign in to comment.