public void FireChange(params Expression <Func <TWidget, object> >[] targetProperties) { bool needSetSourceAsBatch = !IsTargetBatchUpdate && targetProperties.Length > 1; if (needSetSourceAsBatch) { IsSourceBatchUpdate = true; } foreach (var Property in targetProperties) { var chain = PropertyChainFromExp.Get(Property); if (IsTargetBatchUpdate) { if (!delayFiredChains.Exists(c => PropertyChainFromExp.GetChainName(chain) == PropertyChainFromExp.GetChainName(c))) { delayFiredChains.Add(chain); } } else { SourceSetValue( PropertyChainFromExp.GetChainName(chain), TargetGetValue(chain) ); } } if (needSetSourceAsBatch) { FinishSourceUpdateBatch(); } }
internal void FinishTargetUpdateBatch() { IsTargetBatchUpdate = false; delayFiredChains.ForEach( c => SourceSetValue(PropertyChainFromExp.GetChainName(c), TargetGetValue(c))); }