Exemplo n.º 1
0
 //Move selected items from source list to destination list
 private void moveListItems(ListBox source, ListBox destination)
 {
     //Check if an item is selected
     if (source.SelectedIndex != -1)
     {
         //Move all selected items, multiple selection enabled
         foreach (var item in source.SelectedItems)
         {
             destination.Items.Add(item);
             Stavka s = item as Stavka;
             //Check if the category of the items do not corresponds to the category of the listBox we want to place it
             if ((s.Category == "Овошје" && destination == lbRight) || (s.Category == "Зеленчук" && destination == lbLeft))
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.smiley    = s.image;
                 pomoshna.text2     = s.description;
                 pomoshna.buttonYes = "Во ред";
                 pomoshna.Show();
             }
         }
         //Remove the selected items from the source list, while there are selected items
         //Must do this, because they will remain in the source list too
         while (source.SelectedItems.Count > 0)
         {
             source.Items.Remove(source.SelectedItems[0]);
         }
     }
 }
Exemplo n.º 2
0
        //Checks if the location of person is in on the Zebra and the light is red
        public void NaZebraICrvenoSvetlo()
        {
            //the end point
            int pocetokulica = Resources.sidewalk_Up.Height - 20;
            int krajulica    = pocetokulica + Resources.street.Height;

            if (!lightColor && Y > pocetokulica && Y < krajulica)
            {
                pomoshna           = new Pomoshna();
                pomoshna.text1     = "На добар пат си да ја поминеш улицата";
                pomoshna.text2     = "Тргна на зелено, но ти се уклучи црвено ";
                pomoshna.text3     = "Обиди се повторно";
                pomoshna.buttonYes = "Во ред";
                pomoshna.buttonNo  = null;
                pomoshna.smiley    = Resources.smiley;
                pomoshna.Show();
                Y = 300;
            }
        }
Exemplo n.º 3
0
 public void Move()
 {
     if (direction == DIRECTION.UP)
     {
         person = Resources.Person1_Up;
         if ((Y - 10) > 0)
         {
             Y -= 10;
         }
         //If the person goes UP and he is not in between the Zebra
         if (!CheckLocation())
         {
             pomoshna           = new Pomoshna();
             pomoshna.text1     = "Упс";
             pomoshna.text2     = "Улицата се поминува само на пешачки премин";
             pomoshna.text3     = "Обиди се повторно ";
             pomoshna.buttonYes = "Да";
             pomoshna.buttonNo  = null;
             pomoshna.smiley    = sad_smiley;
             pomoshna.Show();
             Y += 10;
         }
         else
         {
             //If the person goes UP and he is in between the Zebra but the trafic light is red
             if (!lightColor && X > formHeight / 2)
             {
                 Y                  = 300;
                 pomoshna           = new Pomoshna();
                 pomoshna.text2     = "Улицата се поминува на зелено";
                 pomoshna.buttonYes = "Во ред";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
             }
         }
     }
     if (direction == DIRECTION.LEFT)
     {
         person = Resources.Person1_Left;
         if ((X - 10) > 0)
         {
             X -= 10;
         }
         if (Y < 300)
         {
             //the person is on the Zebra and wants to go  Left
             if (!CheckLocation())
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.text1     = "Не Не";
                 pomoshna.text2     = "Движи се по пешачкиот премир, не оди лево и десно";
                 pomoshna.text3     = "Обиди се повторно ";
                 pomoshna.buttonYes = "Да";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
                 X += 10;
             }
         }
     }
     if (direction == DIRECTION.RIGHT)
     {
         person = Resources.Person1_Right;
         if ((X + 10) < formWidth - person.Width)
         {
             X += 10;
         }
         if (Y < 300)
         {
             //the person is on the Zebra and wants to go Right
             if (!CheckLocation())
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.text1     = "Не Не";
                 pomoshna.text2     = "Движи се по пешачкиот премир, не оди лево и десно";
                 pomoshna.text3     = "Обиди се повторно ";
                 pomoshna.buttonYes = "Да";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
                 X -= 10;
             }
         }
     }
 }