private void Button_Clicked(object sender, EventArgs e) { if (Symptoms.Count > 0) { var ids = Symptoms.ToArray(); var prediction = APIInterface.Predict(ids.Select(x => x.ID).ToArray()); if (prediction != null) { if (prediction.StateCode == 2) { var dis = prediction.ResultDisease; var det = DataModel.GetDetails(dis.ID); Navigation.PushAsync(new VDiseaseDetials(dis, det)); } else if (prediction.StateCode == 1) { Navigation.PushAsync(new VQuestion(prediction.ResultSymptoms.ToList(), ids.ToList())); } else { DisplayAlert("Error", "Some thing went wrong! .. Retry", "Ok"); } } else { DisplayAlert("Error", "Some thing went wrong! .. Retry", "Ok"); } } else { DisplayAlert("Error", "Please Select Your Main Symptoms!", "Ok"); } }
private void Button_Clicked(object sender, EventArgs e) { if (NoAnswers()) { DisplayAlert("Error", "Please select at least one answer!", "Ok"); } else { var sympId = Q1.IsChecked ? sympsQ[0] : Q2.IsChecked ? sympsQ[1] : Q3.IsChecked ? sympsQ[2] : null; if (sympId != null) { symps.Add(sympId); } var prediction = APIInterface.Predict(symps.Select(x => x.ID).ToArray()); if (prediction != null) { if (prediction.StateCode == 2) { var dis = prediction.ResultDisease; var det = DataModel.GetDetails(dis.ID); Navigation.PushAsync(new VDiseaseDetials(dis, det)); } else if (prediction.StateCode == 1) { Navigation.PushAsync(new VQuestion(prediction.ResultSymptoms.ToList(), symps)); } else { DisplayAlert("Error", "Some thing went wrong! .. Retry", "Ok"); } } else { DisplayAlert("Error", "Some thing went wrong! .. Retry", "Ok"); } } }