Example #1
0
 private void BGWControlGame_DoWork(object sender, DoWorkEventArgs e)
 {
     if (!btn2.Contains(senderButton))
     {
         btn2.Add(senderButton);
         var btn_ = generatePaths.Where(x => x.FileButton1 == senderButton).Select(x => x.FilePath1);
         senderButton.BackgroundImage = Image.FromFile(btn_.Select(x => x.ToString()).FirstOrDefault());
         i_++;
     }
     if (i_ == 2)
     {
         i_ = 0;
         if (clearButton.Control(generatePaths, btn2[0], btn2[1]))
         {
             Thread.Sleep(1000);
             this.Controls.Remove(btn2[0]);
             this.Controls.Remove(btn2[1]);
             UserManager.Puan += 10;
             Text              = UserManager.s + UserManager.Puan;
             btn2.Clear();
         }
         else
         {
             Thread.Sleep(1000);
             this.Controls[btn2[0].Name].BackgroundImage = clearButton.Default_Image;
             this.Controls[btn2[1].Name].BackgroundImage = clearButton.Default_Image;
             btn2.Clear();
         }
     }
 }