public async Task RunPythonFile(string filename, string configFile) { var process = new ProcessWrapper(filename, "--config \"" + configFile + "\""); process.OutputDataReceived += (sender, eventArgs) => { if (!string.IsNullOrWhiteSpace(eventArgs.Data)) { string dataString = eventArgs.Data.Replace("\f", ""); dataString = dataString.TrimStart(); if (dataString.StartsWith("Epoch")) { string[] epochText = dataString.Split(' '); if (epochText.Length > 1) { string[] epochNumbers = epochText[1].Split('/'); bool epochDoneParsed = double.TryParse(epochNumbers[0], NumberStyles.Float, CultureInfo.InvariantCulture, out double epochDone); bool epochTotalParsed = double.TryParse(epochNumbers[1], NumberStyles.Float, CultureInfo.InvariantCulture, out double epochTotal); if (epochDoneParsed && epochTotalParsed) { _viewModel.Progress = 100 * epochDone / epochTotal; UpdateEta(); } } } _viewModel.ConsoleOutputText += dataString + "\n\n"; } }; process.ErrorDataReceived += (sender, eventArgs) => { if (eventArgs.Data != null && _showErrors) { _viewModel.ConsoleOutputText += eventArgs.Data + "\n\n"; } }; pythonAppId = process.Start(); await process.ExitedAsync(); pythonAppId = 0; RunAnnotationsButton.Visibility = Visibility.Visible; StopAnnotationsButton.Visibility = Visibility.Hidden; RunAnnotationsButton.IsEnabled = true; PredictRadioButton.IsEnabled = true; TrainRadioButton.IsEnabled = true; SelectAudioSourceButton.IsEnabled = true; SelectMateBookButton.IsEnabled = true; SelectOutputFolderButton.IsEnabled = true; WeightsFileButton.IsEnabled = true; _viewModel.Progress = 0.0; _viewModel.Progress2 = 0.0; }