private async void ChangeLevelButton_Click(object sender, RoutedEventArgs e) { Animations.Menu menu = new Animations.Menu(); double countBottom = -485; ChangeLevelButton.IsEnabled = false; await Task.Run(() => { Dispatcher.Invoke(() => panel.Visibility = Visibility.Visible); Dispatcher.Invoke(() => panel.IsEnabled = true); while (countBottom < 0) { Thread.Sleep(3); Dispatcher.Invoke(() => menu.MenuHide(SudokuGrid, panel, menuCanvas, countBottom)); Dispatcher.Invoke(() => panel.Visibility = Visibility.Visible); Dispatcher.Invoke(() => panel.IsEnabled = true); countBottom += 5; } Dispatcher.Invoke(() => ChangeLevelButton.IsEnabled = true); }); }
private void LevelButton_Click(object sender, RoutedEventArgs e) { if (REasy.IsChecked == true) { Level = 45; } if (RNormal.IsChecked == true) { Level = 28; } if (RHard.IsChecked == true) { Level = 14; } Animations.Menu menu = new Animations.Menu(); RotateTransform rotateTransform = new RotateTransform(); double countBottom = 0; RefreshButton.Visibility = Visibility.Hidden; ChangeLevelButton.Visibility = Visibility.Hidden; canvasDrop = new Canvas(); Grid.SetColumnSpan(canvasDrop, 13); Grid.SetRowSpan(canvasDrop, 16); SudokuGrid.Children.Add(canvasDrop); Canvas canvasDrop2 = new Canvas(); Grid.SetColumnSpan(canvasDrop2, 13); Grid.SetRowSpan(canvasDrop2, 16); SudokuGrid.Children.Add(canvasDrop2); DateTime dateTime = DateTime.Now; Image imageBox = new Image(); Task.Run(() => { while (countBottom > -485) { Thread.Sleep(2); Dispatcher.Invoke(() => menu.MenuHide(SudokuGrid, panel, menuCanvas, countBottom)); Dispatcher.Invoke(() => panel.Visibility = Visibility.Visible); Dispatcher.Invoke(() => panel.IsEnabled = true); countBottom -= 5; if (countBottom == -200) { Dispatcher.Invoke(() => RefreshButton.Visibility = Visibility.Visible); Dispatcher.Invoke(() => ChangeLevelButton.Visibility = Visibility.Visible); } } MenuPanelWrapingAfectedControls(); IsBirthday = false; }); }