Esempio n. 1
0
        public async void Clicker(MemField memField, List <MemField> fieldsList)
        {
            if (fieldsList.Count(mm => mm.Clicked) >= 2 || memField.Clicked)
            {
                return;                            // 2 clicked
            }
            if (!fieldsList.Any(mm => mm.Clicked)) // if nothing is clicked...
            {
                memField.Clicked = true;
                memField.ShowPicture(memField);
                return;
            }

            //if one of blocks is clicked...
            memField.ShowPicture(memField);
            memField.Clicked = true;
            await Task.Delay(1000);

            var helpInt = 0;

            fieldsList.Where(field => field.Clicked).ToList().ForEach(mm => helpInt += mm.Sign);                     // chceck Sign
            fieldsList.FindAll(ff => ff.Clicked).ForEach(mm => mm.Visible            = helpInt == 0 ? false : true); // set visible if sign is the same or different
            //change back a picture and clicked..
            fieldsList.FindAll(ff => ff.Clicked).ForEach(mm => mm.PictureBack());
            fieldsList.ForEach(ff => ff.Clicked = false);
        }
Esempio n. 2
0
 public void ShowPicture(MemField memField)
 {
     memField.BackgroundImage = Image.FromFile("../../MemoryImage/" + (memField.Sign > 0 ? memField.Sign : memField.Sign * -1) + ".png");
 }
Esempio n. 3
0
 private void PreShowMe(MemField field)
 {
     field.Visible         = true;
     field.BackgroundImage = Image.FromFile("../../MemoryImage/20.png");
 }