Esempio n. 1
0
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            recordData.ItemsSource  = null;
            recordData2.ItemsSource = null;
            recordList2.Clear();
            recordList3.Clear();
            int skaits = 0;

            if (amount.SelectedIndex == 0)
            {
                skaits = 5;
            }
            else if (amount.SelectedIndex == 1)
            {
                skaits = 10;
            }
            else if (amount.SelectedIndex == 2)
            {
                skaits = 20;
            }
            if (pickGameRecord.SelectedIndex == 0)
            {
                snakeRecordPanel.Visibility   = Visibility.Visible;
                shooterRecordPanel.Visibility = Visibility.Collapsed;
                if (skaits < snakeRecordList.Count)
                {
                    for (int i = 0; i < skaits; i++)
                    {
                        for (int j = 0; j < userList.Count; j++)
                        {
                            if (snakeRecordList[i].ID_user == userList[j].ID_user)
                            {
                                recordClass temp = new recordClass();
                                temp.username = userList[j].username;
                                temp.score    = (int)snakeRecordList[i].score;
                                temp.level    = (int)snakeRecordList[i].lvl;
                                recordList2.Add(temp);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < snakeRecordList.Count; i++)
                    {
                        for (int j = 0; j < userList.Count; j++)
                        {
                            if (snakeRecordList[i].ID_user == userList[j].ID_user)
                            {
                                recordClass temp = new recordClass();
                                temp.username = userList[j].username;
                                temp.score    = (int)snakeRecordList[i].score;
                                temp.level    = (int)snakeRecordList[i].lvl;
                                recordList2.Add(temp);
                                break;
                            }
                        }
                    }
                }
                recordData.ItemsSource = recordList2;
            }
            else if (pickGameRecord.SelectedIndex == 1)
            {
                snakeRecordPanel.Visibility   = Visibility.Collapsed;
                shooterRecordPanel.Visibility = Visibility.Visible;
                if (skaits < shooterRecordList.Count)
                {
                    for (int i = 0; i < skaits; i++)
                    {
                        for (int j = 0; j < userList.Count; j++)
                        {
                            if (shooterRecordList[i].ID_user == userList[j].ID_user)
                            {
                                recordClass2 temp = new recordClass2();
                                temp.username = userList[j].username;
                                temp.score    = (int)shooterRecordList[i].score;
                                recordList3.Add(temp);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < shooterRecordList.Count; i++)
                    {
                        for (int j = 0; j < userList.Count; j++)
                        {
                            if (shooterRecordList[i].ID_user == userList[j].ID_user)
                            {
                                recordClass2 temp = new recordClass2();
                                temp.username = userList[j].username;
                                temp.score    = (int)shooterRecordList[i].score;
                                recordList3.Add(temp);
                                break;
                            }
                        }
                    }
                }
                recordData2.ItemsSource = recordList3;
            }
        }
Esempio n. 2
0
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     recordData.ItemsSource = null;
     recordData2.ItemsSource = null;
     recordList2.Clear();
     recordList3.Clear();
     int skaits = 0;
     if (amount.SelectedIndex == 0)
     {
         skaits = 5;
     }
     else if (amount.SelectedIndex == 1)
     {
         skaits = 10;
     }
     else if (amount.SelectedIndex == 2)
     {
         skaits = 20;
     }
     if (pickGameRecord.SelectedIndex == 0)
     {
         snakeRecordPanel.Visibility = Visibility.Visible;
         shooterRecordPanel.Visibility = Visibility.Collapsed;
         if (skaits < snakeRecordList.Count)
         {
             for (int i = 0; i < skaits; i++)
             {
                 for (int j = 0; j < userList.Count; j++)
                 {
                     if (snakeRecordList[i].ID_user == userList[j].ID_user)
                     {
                         recordClass temp = new recordClass();
                         temp.username = userList[j].username;
                         temp.score = (int)snakeRecordList[i].score;
                         temp.level = (int)snakeRecordList[i].lvl;
                         recordList2.Add(temp);
                         break;
                     }
                 }
             }
         }
         else
         {
             for (int i = 0; i < snakeRecordList.Count; i++)
             {
                 for (int j = 0; j < userList.Count; j++)
                 {
                     if (snakeRecordList[i].ID_user == userList[j].ID_user)
                     {
                         recordClass temp = new recordClass();
                         temp.username = userList[j].username;
                         temp.score = (int)snakeRecordList[i].score;
                         temp.level = (int)snakeRecordList[i].lvl;
                         recordList2.Add(temp);
                         break;
                     }
                 }
             }
         }
         recordData.ItemsSource = recordList2;
     }
     else if (pickGameRecord.SelectedIndex == 1)
     {
         snakeRecordPanel.Visibility = Visibility.Collapsed;
         shooterRecordPanel.Visibility = Visibility.Visible;
         if (skaits < shooterRecordList.Count)
         {
             for (int i = 0; i < skaits; i++)
             {
                 for (int j = 0; j < userList.Count; j++)
                 {
                     if (shooterRecordList[i].ID_user == userList[j].ID_user)
                     {
                         recordClass2 temp = new recordClass2();
                         temp.username = userList[j].username;
                         temp.score = (int)shooterRecordList[i].score;
                         recordList3.Add(temp);
                         break;
                     }
                 }
             }
         }
         else
         {
             for (int i = 0; i < shooterRecordList.Count; i++)
             {
                 for (int j = 0; j < userList.Count; j++)
                 {
                     if (shooterRecordList[i].ID_user == userList[j].ID_user)
                     {
                         recordClass2 temp = new recordClass2();
                         temp.username = userList[j].username;
                         temp.score = (int)shooterRecordList[i].score;
                         recordList3.Add(temp);
                         break;
                     }
                 }
             }
         }
         recordData2.ItemsSource = recordList3;
     }
 }