diff --git a/TheGameExtreme/IO/IOGamePreparation.cs b/TheGameExtreme/IO/IOGamePreparation.cs
index fa02f11..2a1dd28 100644
--- a/TheGameExtreme/IO/IOGamePreparation.cs
+++ b/TheGameExtreme/IO/IOGamePreparation.cs
@@ -11,6 +11,7 @@ namespace TheGameExtreme.IO
static string pathPlayers = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NbPlayers.xml");
static string pathGameModeValue = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "GameModeValue.xml");
static string pathNbStacks = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NbStacks.xml");
+ static string pathNbCards = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NbCards.xml");
public static void SaveParamaterGamePreparationNbPlayers(int nbPlayers)
{
@@ -87,5 +88,30 @@ namespace TheGameExtreme.IO
return 0;
}
}
+
+ public static void SaveParameterGamePreparationNbCards(int nbCard)
+ {
+ XmlSerializer xs = new XmlSerializer(typeof(int));
+ TextWriter tw = new StreamWriter(pathNbCards);
+ xs.Serialize(tw, nbCard);
+ tw.Close();
+ }
+
+ public static int LoadParameterGamePreparationNbCards()
+ {
+ XmlSerializer xs = new XmlSerializer(typeof(int));
+ try
+ {
+ using (FileStream fs = new FileStream(pathNbCards, FileMode.Open))
+ {
+ int nbCards = (int)xs.Deserialize(fs);
+ return nbCards;
+ }
+ }
+ catch
+ {
+ return 0;
+ }
+ }
}
}
diff --git a/TheGameExtreme/view/GamePreparationPage.xaml b/TheGameExtreme/view/GamePreparationPage.xaml
index 44c2acd..33a7fa4 100644
--- a/TheGameExtreme/view/GamePreparationPage.xaml
+++ b/TheGameExtreme/view/GamePreparationPage.xaml
@@ -12,9 +12,10 @@
+
-
+
@@ -99,8 +100,9 @@
+ Grid.Row="0"
+ Grid.Column="2"
+ Margin="0,0,20,0">
+
+
+
+
+
+
@@ -147,13 +169,14 @@
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
-
+
+
diff --git a/TheGameExtreme/view/GamePreparationPage.xaml.cs b/TheGameExtreme/view/GamePreparationPage.xaml.cs
index 831f015..605d4f5 100644
--- a/TheGameExtreme/view/GamePreparationPage.xaml.cs
+++ b/TheGameExtreme/view/GamePreparationPage.xaml.cs
@@ -10,6 +10,7 @@ namespace TheGameExtreme.view
public List listNbPlayer = new List { 1, 2, 3, 4, 5 };
public List listGameMode = new List { "entières", "relatives", "décimales", "dizaines", "centaines", "millièmes", "fractionnées" };
public List listNbStack = new List { 4, 6, 8 };
+ public List listNbCard = new List { 100, 80, 60, 40 };
public GamePreparationPage()
@@ -26,6 +27,9 @@ namespace TheGameExtreme.view
SelectNbStack.ItemsSource = listNbStack;
LoadParameterNbStacksGamePreparation();
+ SelectNbCard.ItemsSource = listNbCard;
+ LoadParameterNbCardsGamePreparation();
+
}
@@ -35,6 +39,7 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
+ IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
await Navigation.PopAsync();
}
protected override bool OnBackButtonPressed()
@@ -42,6 +47,7 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
+ IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
return base.OnBackButtonPressed();
}
@@ -62,6 +68,7 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
+ IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex));
}
@@ -108,6 +115,11 @@ namespace TheGameExtreme.view
int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks();
SelectNbStack.SelectedIndex = nbStackSer;
}
+ public void LoadParameterNbCardsGamePreparation()
+ {
+ int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards();
+ SelectNbCard.SelectedIndex = nbCards;
+ }