public void UpdateHeaderView() { if (FormModels.Any()) { CountOfForms = string.Format(" {0} {1}", Resources.lblFrom, FormModels.Count.ToString()); } }
private async Task UpdateGridAsync(UpdateFormEventArgs updatedFormArgs) { Guid callingOwnerId = updatedFormArgs.OwnerChooseModel.Id; Guid?formId = updatedFormArgs.FormId; string path = string.Format("{0}/{1}", RoutingConstants.FormRoute, formId.ToString()); try { BusyIndicator.BlockUI(); var result = await requestManager.GetAsync <FormModel>(path); if (result.Data == null || result.IsError) { await InitializeAsync(true); } else { FormModel resultForm = result.Data; if (updatedFormArgs.IsNew) { bool scrollToFirst = false; if (OwnerChooseModel != null) { if (OwnerChooseModel.Id == callingOwnerId) { FormModels.Add(resultForm); SelectedForm = FormModels.FirstOrDefault(x => x.IdForm.Equals(resultForm.IdForm)); } else { scrollToFirst = true; } } else { FormModels.Add(resultForm); SelectedForm = FormModels.FirstOrDefault(x => x.IdForm.Equals(resultForm.IdForm)); } ScrollOrRefreshGrid(this, new CleanFilterEventArgs() { ScrollToFirst = scrollToFirst }); } else { FormModel editedFormModel = FormModels.FirstOrDefault(x => x.IdForm == formId); if (editedFormModel != null) { if (OwnerChooseModel != null && callingOwnerId != OwnerChooseModel.Id) { if (FormModels.Any()) { FormModels.Remove(editedFormModel); } } else { int editedFormModelIndex = FormModels.IndexOf(editedFormModel); if (editedFormModelIndex != -1) { FormModels[editedFormModelIndex] = resultForm; } } } } } } finally { BusyIndicator.UnblockUI(); } }