//Blockerar så att man inte kan aktivera hover eller klicka på rektanglarna public void Blockclickproperly() { while (_numberOfFalling > 0) { ; } Thread.Sleep(25); if (window.BlockClicks.Dispatcher.CheckAccess()) { window.BlockClicks.Visibility = Visibility.Hidden; while (window.BlockClicks.Visibility == Visibility.Visible) { ; } bool ok = func.checkForPossible(que2, _rectSize); if (!ok) { _Timer.Stop(); window.canvas1.Children.Clear(); boardIsFull = false; fillPlayField(); _Timer.Start(); } window.lbl.Content = ""; } else { window.BlockClicks.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new EnabledChanged(this.Blockclickproperly)); } }//Blockclickproperly
}//checkForHoleThread //Blockerar så att man inte kan aktivera hover eller klicka på rektanglarna public void Blockclickproperly() { while (_numberOfFalling > 0) { ; } //dra ihop --------------------------------------- Thread pullTogether = new Thread(new ThreadStart(checkForHoleThread)); pullTogether.Start(); while (pullTogether.ThreadState == System.Threading.ThreadState.Running) { ; } System.Threading.Thread.Sleep(70); //centerBlocks(); if (window.BlockClicks.Dispatcher.CheckAccess()) { window.BlockClicks.Visibility = Visibility.Hidden; while (window.BlockClicks.Visibility == Visibility.Visible) { ; } func.checkForPossible(que2, _rectSize); bool ok = func.checkForPossible(que2, _rectSize); if (!ok) { window.canvas1.Children.Clear(); boardIsFull = false; fillPlayField(); } } else { window.BlockClicks.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new EnabledChanged(this.Blockclickproperly)); } }//Blockclickproperly
}//checkForHoleThread //Blockerar så att man inte kan aktivera hover eller klicka på rektanglarna public void Blockclickproperly() { while (_numberOfFalling > 0) { ; } //dra ihop --------------------------------------- Thread pullTogether = new Thread(new ThreadStart(checkForHoleThread)); pullTogether.Start(); while (pullTogether.ThreadState == System.Threading.ThreadState.Running) { ; } System.Threading.Thread.Sleep(50); //centerBlocks(); if (window.BlockClicks.Dispatcher.CheckAccess()) { window.BlockClicks.Visibility = Visibility.Hidden; while (window.BlockClicks.Visibility == Visibility.Visible) { ; } func.checkForPossible(que2, _rectSize); bool ok = func.checkForPossible(que2, _rectSize); if (!ok) { tries--; window.tries.Content = tries; window.timeFS.Content = tries; window.Points.Content = scorePoints(window.canvas1.Children.Count); window.scoreFS.Content = window.Points.Content; if (window.canvas1.Children.Count == 0) { level++; tries = level * 5; window.level.Content = level; window.levelFS.Content = level; window.tries.Content = tries; window.timeFS.Content = tries; levelUp(); } if (tries != 0) { window.canvas1.Children.Clear(); boardIsFull = false; fillPlayField(); } else { window.playScreen.Opacity = 0.2; window.fullscreenLeft.Opacity = 0.2; window.fullscreenRight.Opacity = 0.2; GameOver gameover = new GameOver(window.Points.Content.ToString(), window.modeChoice); window.ContentArea.Content = gameover; window.playScreen.IsEnabled = false; window.fullscreenLeft.IsEnabled = false; _numberOfColors = 2; window.extraWindows.Visibility = Visibility.Visible; level = 1; tries = 5; } window.tries.Content = tries; } } else { window.BlockClicks.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new EnabledChanged(this.Blockclickproperly)); } }//Blockclickproperly