private void CreateFilledCell(int i, int j, string content) { var grid = new gridCellUser(); Image imgControl = ImageCreateGameIcon(content); imgControl.Loaded += async(s, e) => { var rnd = new Random(i * 100 + j); while (true) { await SetIconGameAnimation(imgControl, rnd); } }; Grid.SetRow(imgControl, 0); var lblControl = LabelCreateGameName(content); Grid.SetRow(lblControl, 2); grid.contentGrid.Children.Add(imgControl); grid.contentGrid.Children.Add(lblControl); ThicknessAnimation marginAnimation = MarginAnimation(); DoubleAnimation fontAnimation = FontAnimation(); grid.contentGrid.MouseDown += async(o, e) => OnClickGame(content, grid, lblControl, marginAnimation, fontAnimation); grid.contentGrid.TouchDown += async(o, e) => OnClickGame(content, grid, lblControl, marginAnimation, fontAnimation); Grid.SetRow(grid, i); Grid.SetColumn(grid, j); gamesGrid.Children.Add(grid); }
private async Task OnClickGame(string content, gridCellUser grid, TextBlock lblControl, ThicknessAnimation marginAnimation, DoubleAnimation fontAnimation) { if (false) { WindowAPI.SetWindowExTransparent(hwnd); } grid.contentGrid.IsEnabled = false; grid.contentGrid.BeginAnimation(MarginProperty, marginAnimation); lblControl.BeginAnimation(Label.FontSizeProperty, fontAnimation); var task = GameManager.RunGame(content); //if (isClickable) //{ // isClickable = false; // try // { // grid.contentGrid.BeginAnimation(MarginProperty, marginAnimation); // lblControl.BeginAnimation(Label.FontSizeProperty, fontAnimation); // var task = GameManager.RunGame(content); // } // catch (Exception ex) // { // Show(ex.Message); // isClickable = true; // } //} await Task.Delay(3000); grid.contentGrid.IsEnabled = true; //isClickable = true; if (false) { WindowAPI.RemoveWindowExTransparent(hwnd); } }