public virtual async Task <T> UpdateProperty <T>( string propertyName, T publicValue, T privateValue, object eventCallback = null, Expression <Func <T> > expression = null) { CellDataBoundComponent dataBoundComponent = this; T finalResult = publicValue; if (!EqualityComparer <T> .Default.Equals(publicValue, privateValue)) { T newValue = dataBoundComponent.DirectParameters.ContainsKey(propertyName) ? (T)dataBoundComponent.DirectParameters[propertyName] : publicValue; bool flag = eventCallback != null && ((EventCallback <T>)eventCallback).HasDelegate; bool isPropertyBinding = !CellBaseUtils.Equals(publicValue, newValue) && dataBoundComponent.IsRerendering; CellBaseComponent sfBaseComponent = dataBoundComponent.MainParent != null ? dataBoundComponent.MainParent : dataBoundComponent; finalResult = dataBoundComponent.IsRerendering & flag | isPropertyBinding || !sfBaseComponent.IsRendered ? publicValue : privateValue; if (flag) { await((EventCallback <T>)eventCallback).InvokeAsync(finalResult); } if (isPropertyBinding) { dataBoundComponent.DirectParameters[propertyName] = finalResult; CellBaseUtils.UpdateDictionary(propertyName, finalResult, dataBoundComponent.PropertyChanges); } } T obj = finalResult; finalResult = default; return(obj); }
public T NotifyPropertyChanges <T>(string propertyName, T publicValue, T privateValue) { if (!CellBaseUtils.Equals <T>(publicValue, privateValue)) { CellBaseUtils.UpdateDictionary(propertyName, (object)publicValue, this.PropertyChanges); } return(publicValue); }