private Task <ISupervisedModel> GetModel(ISupervisedTrainer trainer) { Progress <ClusteringProgress> progress = new Progress <ClusteringProgress>(ReportProgress); return(trainer.TrainAsync(_trainingImage, bandSelectorControl.SelectedBands, _clusteringImage, SelectedClusteringBand, progress, _cancellationTokenSource.Token)); }
private async void TryTrainingAsync(ISupervisedTrainer trainer) { try { StartProgress(); Model = await GetModel(trainer); EndProgress(); AcceptResult(); } catch (ArgumentException) { EndProgress(); ShowPixelCountErrorMessage(); } catch (OperationCanceledException) { InterruptionInProgress(false); EndProgress(); } }