private void Dispatcher_Tick(object sender, EventArgs e) { if (MonteCarloRadioButton.IsChecked == true) { currRange = mc.Grow(prevRange, nucleons); properties.MCS--; if (properties.MCS <= 0) { if (AfterInclusionRadioButton.IsChecked == true && InclusionsCheckBox.IsChecked == true) { AddInclusionsButton_Click(new object(), new RoutedEventArgs()); } SetEnableSubStrAndBoundCheckBoxs(); Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; }); currRange.IsFull = true; dispatcher.Stop(); } if (nucleons.TypeOfcreation == TypeOfNucleonsCreation.Constant) { prevRange = nucleons.InitializeNucleons(currRange, nucleons); } else if (nucleons.TypeOfcreation == TypeOfNucleonsCreation.Increasing) { nucleons.AmountOfNucleons += tempIteration; prevRange = nucleons.InitializeNucleons(currRange, nucleons); } } else { currRange = ca.Grow(prevRange, properties); if (currRange.IsFull) { if (AfterInclusionRadioButton.IsChecked == true && InclusionsCheckBox.IsChecked == true) { AddInclusionsButton_Click(new object(), new RoutedEventArgs()); } SetEnableSubStrAndBoundCheckBoxs(); Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; }); dispatcher.Stop(); } } prevRange = currRange; Image.Source = Converters.BitmapToImageSource(currRange.StructureBitmap); }