private void UpdateSettings() { var length = (int)sldLength.Value; var characters = _checks .Where(x => x.IsChecked != null && x.IsChecked.Value) .SelectMany(x => x.Characters) .ToArray(); var results = new GenerationResults( characters, length); lstResults.ItemsSource = results; }
private void UpdateSettings() { var dispatcher = Dispatcher; dispatcher.BeginInvoke(() => { var length = (int)sldLength.Value; var characters = _checks .Where(x => x.IsChecked != null && x.IsChecked.Value) .SelectMany(x => x.Characters) .ToArray(); ThreadPool.QueueUserWorkItem(_ => { var results = new GenerationResults( characters, length); dispatcher.BeginInvoke(() => lstResults.ItemsSource = results); }); }); }