I am getting know with Windows Phone, and C# as well. I found out that there is an
IndexOutOfRangeException in my Coloring() function:
public void Coloring()
{
szinek_base.Add(Color.FromArgb(255, 0, 171, 169));
szinek_base.Add(Color.FromArgb(255, 140, 191, 38));
szinek_base.Add(Color.FromArgb(255, 160, 80, 0));
szinek_base.Add(Color.FromArgb(255, 230, 113, 184));
szinek_base.Add(Color.FromArgb(255, 240, 150, 9));
szinek_base.Add(Color.FromArgb(255, 27, 161, 226));
szinek_base.Add(Color.FromArgb(255, 229, 20, 0));
szinek_base.Add(Color.FromArgb(255, 51, 153, 51));
int remove;
Color szin = new Color();
Random generator = new Random();
List<int> lapok = new List<int>();
for (int l = 0; l < 16; l++)
{
lapok.Add(l);
}
for (int i = 0; i < 8; i++)
{
szin = szinek_base[generator.Next(0, szinek_base.Count)];
remove = lapok[generator.Next(0, lapok.Count)];
szinek[remove] = szin;
lapok.Remove(remove);
szinek_base.Remove(szin);
remove = lapok[generator.Next(0, lapok.Count)];
szinek[remove] = szin;
lapok.Remove(remove);
szinek_base.Remove(szin);
}
}
Using try-catch i also found out that the second for() cycle contains the bug.
However if i split into half the block and using try-catch, it wont find error nor in the first part
neither the second. This code works fine under windows 7 as part of a memory game by the way, i am out of ideas.
Thanks for the help, and sorry for grammatic and other mistakes, i am not aware of StackOverflow protocol, yet.
Edit: Forgot to mention, the main namespace contains them:
public List<Color> szinek_base = new List<Color>();
Color[] szinek = new Color[8];
No comments:
Post a Comment