private void TrainButton_Click(object sender, RoutedEventArgs e) { IterationModel iterationModel = null; try { iterationModel = MainWindow.currentWindow.TrainProject(projectId); } catch (HttpOperationException ex) { string result = ex.Response.Content; TrainResponseModel response = Utils.Utils.JsonDeserialize <TrainResponseModel>(result); if (response != null && !String.IsNullOrEmpty(response.Code)) { switch (response.Code) { case "BadRequestTrainingNotNeeded": MessageBox.Show("Nothing has changed since previous training."); return; case "BadRequestTrainingValidationFailed": MessageBox.Show("Your project can't be trained just yet. Make sure you have at least 2 tags with at least 5 images in each."); return; default: MessageBox.Show(response.Code); return; } } else { RateLimitResponseModel limitResponse = Utils.Utils.JsonDeserialize <RateLimitResponseModel>(result); if (limitResponse != null) { MessageBox.Show(limitResponse.message); return; } } MessageBox.Show("an error occurs"); return; } IterationPage iterationPage = new IterationPage(projectId, projectName, iterationModel); this.NavigationService.Navigate(iterationPage); }
private void IterationButton_Click(object sender, RoutedEventArgs e) { IterationPage iterationPage = new IterationPage(projectId, projectName); this.NavigationService.Navigate(iterationPage); }