private void ThreadCount_TextChanged(object sender, TextChangedEventArgs e) { if (sender is TextBox tb) { if (int.TryParse(tb.Text, out int newThreadCount)) { if (newThreadCount > 0 && newThreadCount < 512) { theNeuronArray.SetThreadCount(newThreadCount); } } } }