public NetworkTestingViewModel(NeuralNetwork network, PatternContainer patternContainer) { _network = network; _patternContainer = patternContainer; PredictCommand = new AsyncRelayCommand(async() => await Task.Run(() => Predict())); AddToTrainingSetCommand = new RelayCommand(() => { var dialog = new Views.SavePatternAsDialog { ResponseText = Predictions?.FirstOrDefault(p => p.IsHighest)?.Name ?? string.Empty }; if (dialog.ShowDialog() != true) { return; } var pattern = new Pattern { Name = dialog.ResponseText, Rows = 15, Columns = 10 }; // 0 - black, 1 - white pattern.FillUsing(Pixels.Cast <double>().Select(p => p < 0.5).ToArray()); _patternContainer.Add(pattern); }); }