/// <summary> /// On click on right arrow to switch between candidates /// </summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> /// <returns></returns> async Task OnRightButtonClickedAsync(object sender, EventArgs e) { SwitchCandidate = true; await ConfirmSaveBeforeSwitchAsync(); int index = CandidateList.IndexOf(CandidateList.Where(x => x.Id == CurrentCandidate.Id).First()); Candidate rightCandidate = CandidateList[index + 1].Clone() as Candidate; ChangeCandidate(rightCandidate, index + 1); }
/// <summary> /// Save the evaluation and add signature if needed and if asked /// </summary> /// <param name="signature">Boolean, true if the user has clicked on sign button</param> async void SaveEvaluation(Boolean signature) { if (signature && Eval.Criterias.All(c => !c.SelectedLevel.Equals("")) && !Eval.IsSigned) { ComeBackSigning = true; await Navigation.PushAsync(new SigningPage(Eval, CurrentCandidate)); } Eval.LastUpdatedDate = DateTime.Now; String jsonEval = JsonParser.GenerateJsonEval(Eval); JsonParser.WriteJsonInInternalMemory(jsonEval, CurrentCandidate.Id, LoggedUser.Id, CurrentEvent.Id); foreach (Criteria c in Eval.Criterias) { c.IsModified = false; } Eval.IsModified = false; int index = CandidateList.IndexOf(CandidateList.Where(x => x.Id == CurrentCandidate.Id).First()); CandidateList[index] = CurrentCandidate; CurrentCandidate.CheckStatus(); ChangeStatusImage(); if (Eval.Criterias.All(c => !c.SelectedLevel.Equals(""))) { ButtonSigner.IsEnabled = true; } else { ButtonSigner.IsEnabled = false; } await Task.Run(() => { Device.BeginInvokeOnMainThread(() => { ButtonEnregister.IsEnabled = false; }); EvaluationSender.AddEvaluationInQueue(jsonEval); EvaluationSender.SendJsonEvalToServer(); Device.BeginInvokeOnMainThread(() => { ButtonEnregister.IsEnabled = true; }); }); }