Beispiel #1
0
        private void ExecuteAdd(object obj)
        {
            if (_selected != null)
            {
                if (!Chosen.Contains(_selected))
                {
                    String query = "Select distinct Läsperiod from Läsperioder Where Kurskod LIKE '%" + _selected.Kurskod.Trim() + "%';";
                    foreach (string v in PerformDatabaseStringAccess(query))
                    {
                        StudyPeriods.Add(v);
                    }


                    if (StudyPeriods.Count == 1)
                    {
                        Chosen.Add(_selected.returnNewCourse(StudyPeriods.First()));
                        Messenger.Default.Send <ObservableCollection <Course> >(Chosen);
                        MessageQueue.Enqueue(_selected.ToString() + " tillagd i specialiseringen");
                        StudyPeriods.Clear();
                    }
                    else
                    {
                        OpenDialog = true;
                    }
                }
                else
                {
                    MessageBox.Show("The course has already been chosen for your future specialization");
                }
            }
        }
Beispiel #2
0
 public void ChooseCard(Card card)
 {
     if (Chosen.Contains(card))
     {
         Chosen.Remove(card);
     }
     else
     {
         Chosen.Add(card);
     }
 }
Beispiel #3
0
 private void DealwithThree(kindsOfCombination combination, int CardPlayer)
 {
     for (int i = 0; i < Hand.Count - 2; i++)
     {
         if (Hand[i].rank == Hand[i + 1].rank && Hand[i].rank == Hand[i + 2].rank && Hand[i].rank > (Rank)combination.index)
         {
             Chosen.Add(Hand[i]);
             Chosen.Add(Hand[i + 1]);
             Chosen.Add(Hand[i + 2]);
             break;
         }
     }
     if (combination.assist == 1)
     {
         for (int i = 0; i < Hand.Count; i++)
         {
             if (!Chosen.Contains(Hand[i]))
             {
                 Chosen.Add(Hand[i]);
                 break;
             }
         }
         if (Chosen.Count != 4)
         {
             Chosen.Clear();
         }
     }
     else if (combination.assist == 2)
     {
         for (int i = 0; i < Hand.Count - 1; i++)
         {
             if (!Chosen.Contains(Hand[i]) && !Chosen.Contains(Hand[i + 1]))
             {
                 Chosen.Add(Hand[i]);
                 Chosen.Add(Hand[i + 1]);
                 break;
             }
         }
         if (Chosen.Count != 5)
         {
             Chosen.Clear();
         }
     }
     if (Chosen.Count == 0 && combination.index >= 10) //use bomb
     {
         DealwithBomb(combination, CardPlayer);
     }
 }