private void Paint() { Dispatcher.BeginInvoke(new Action(() => { Score = figure.Score; int x, y; for (int i = 0; i < Figure.HORIZONTAL * Figure.VERTICAL; i++) { y = i / Figure.HORIZONTAL; x = i - (y * Figure.HORIZONTAL); if (figure.GetPanel(x, y)) { blocks[i].Visibility = Visibility.Visible; } else { blocks[i].Visibility = Visibility.Hidden; } } })); }