public override View GetView(int position, View convertView, ViewGroup parent) { try { var view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.EvidenceAgainstHotThoughtListItem, parent, false); var thought = view.FindViewById <TextView>(Resource.Id.txtEvidenceAgainstHotThought); EvidenceAgainstHotThought thoughtEntry = _evidenceAgainstHotThoughtEntries.ElementAt(position); thought.Text = thoughtEntry.Evidence.Trim(); var parentHeldSelectedItemIndex = ((ThoughtRecordWizardEvidenceAgainstHotThoughtStep)_activity).GetSelectedItem(); if (position == parentHeldSelectedItemIndex) { view.SetBackgroundColor(Color.Argb(255, 19, 75, 127)); thought.SetBackgroundColor(Color.Argb(255, 19, 75, 127)); } else { view.SetBackgroundDrawable(null); thought.SetBackgroundDrawable(null); } return(view); } catch (Exception e) { Log.Error(TAG, "GetView: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(_activity, e, _activity.GetString(Resource.String.ErrorGetEvidenceAgainstAdapterView), "EvidenceAgainstHotThoughtItemsAdapter.GetView"); } return(null); } }
public async Task <ActionResult <EvidenceAgainstHotThoughtDto> > CreateEvidenceAgainstHotThought(int automaticThoughtId, CreateEvidenceAgainstHotThoughtDto createEvidenceAgainstHotThoughtDto) { var evidenceagainsthotthought = new EvidenceAgainstHotThought { AutomaticThought = _mapper.Map <AutomaticThought>(await _unitOfWork.AutomaticThoughtRepository.GetItemAsync(automaticThoughtId)), Evidence = createEvidenceAgainstHotThoughtDto.Evidence, ThoughtRecord = _mapper.Map <ThoughtRecord>(await _unitOfWork.ThoughtRecordRepository.GetItemAsync(createEvidenceAgainstHotThoughtDto.ThoughtRecordId)) }; _unitOfWork.EvidenceAgainstHotThoughtRepository.AddItem(evidenceagainsthotthought); if (await _unitOfWork.Complete()) { return(Ok(_mapper.Map <EvidenceAgainstHotThoughtDto>(evidenceagainsthotthought))); } return(BadRequest("Unable to create Evidence Against Hot Thought")); }
private void AddEvidenceAgainstThought() { try { if (_evidenceText == null) { return; } if (string.IsNullOrWhiteSpace(_evidenceText.Text.Trim())) { var resourceString = GetString(Resource.String.evidenceAgainstHotThoughtNoEvidence); _evidenceText.Error = resourceString; return; } EvidenceAgainstHotThought thought = new EvidenceAgainstHotThought(); thought.ThoughtRecordId = GlobalData.ThoughtRecordId; thought.Evidence = _evidenceText.Text.Trim(); if (GlobalData.EvidenceAgainstHotThoughtItems == null) { GlobalData.EvidenceAgainstHotThoughtItems = new List <EvidenceAgainstHotThought>(); } GlobalData.EvidenceAgainstHotThoughtItems.Add(thought); UpdateAdapter(); _evidenceText.Text = ""; } catch (Exception ex) { Log.Error(TAG, "AddEvidenceAgainstThought_Click: Exception - " + ex.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorAddingAgainst), "ThoughtRecordWizardEvidenceAgainstHotThoughtStep.AddEvidenceAgainstThought_Click"); } } }