public new void New(IHost host) { CheckHostsDocument(host); InternalNew(host, false); _ancestors = new Ancestors(); _ancestors.Add(host.Document); UpdateReadOnly(MergeAncestors(_ancestors)); }
public override void New() { var ancestors = new Ancestors(); var documentExpression = new DocumentExpression(); documentExpression.Type = DocumentType.Document; documentExpression.DocumentArgs.OperatorName = ".Frontend.Form"; ancestors.Add(DocumentExpressionForm.Execute(documentExpression)); New(ancestors); }
private void OnObservedPropertyChanged() { DisposeAndClearAncestors(); var ancestor = InitAncestor(); if (ancestor != null) { Ancestors.Add(ancestor); } OnChanged(PathItem); }
//shared with observationbuilder (move to calculatorhelpers) private void AddToAncestorArray(string key, string value) { if (Ancestors.ContainsKey(key)) { //replace it Ancestors[key] = value; } else { //add it Ancestors.Add(key, value); } }
public CollectionChangeSubscriber(object effectiveObject, CollectionPathItem <T> pathItem, Action <PathItemBase <T> > onChanged) : base(effectiveObject, pathItem, onChanged) { var notifyCollectionChange = effectiveObject as INotifyCollectionChanged; if (notifyCollectionChange != null) { SubscribeToCollectionChange(notifyCollectionChange); } foreach (var ancestor in InitAncestors(EffectiveObject)) { Ancestors.Add(ancestor); } }
public PropertyChangeSubscriber(object effectiveObject, PropertyPathItem <T> pathItem, Action <PathItemBase <T> > onChanged) : base(effectiveObject, pathItem, onChanged) { var notifyPropertyChange = effectiveObject as INotifyPropertyChanged; if (notifyPropertyChange != null) { Subscribe(notifyPropertyChange); } var ancestor = InitAncestor(); if (ancestor != null) { Ancestors.Add(ancestor); } }
private void UpdateAncestors(NotifyCollectionChangedEventArgs eventArgs) { switch (eventArgs.Action) { case NotifyCollectionChangedAction.Add: CheckIndexValid(eventArgs.NewStartingIndex, "NewStartingIndex", NotifyCollectionChangedAction.Add); Ancestors.Insert(eventArgs.NewStartingIndex, CreateSubscriberForCollectionItem(eventArgs.NewItems.Cast <object>().Single())); return; case NotifyCollectionChangedAction.Remove: CheckIndexValid(eventArgs.OldStartingIndex, "OldStartingIndex", NotifyCollectionChangedAction.Remove); Ancestors[eventArgs.OldStartingIndex].Dispose(); Ancestors.RemoveAt(eventArgs.OldStartingIndex); return; case NotifyCollectionChangedAction.Replace: CheckIndexValid(eventArgs.OldStartingIndex, "OldStartingIndex", NotifyCollectionChangedAction.Replace); Ancestors[eventArgs.OldStartingIndex].Dispose(); Ancestors[eventArgs.OldStartingIndex] = CreateSubscriberForCollectionItem(eventArgs.NewItems.Cast <object>().Single()); return; case NotifyCollectionChangedAction.Move: CheckIndexValid(eventArgs.OldStartingIndex, "OldStartingIndex", NotifyCollectionChangedAction.Move); CheckIndexValid(eventArgs.NewStartingIndex, "NewStartingIndex", NotifyCollectionChangedAction.Move); var movingAncestor = Ancestors[eventArgs.OldStartingIndex]; Ancestors.RemoveAt(eventArgs.OldStartingIndex); Ancestors.Insert(eventArgs.NewStartingIndex, movingAncestor); return; case NotifyCollectionChangedAction.Reset: DisposeAndClearAncestors(); foreach (var ancestor in InitAncestors(EffectiveObject)) { Ancestors.Add(ancestor); } return; default: throw new ArgumentException(string.Format("Unknown eventArgs.Action enum action: {0}", eventArgs.Action), "eventArgs"); } }
public RootObjectSubscriber(object effectiveObject, PathItemBase <T> pathItem, Action <PathItemBase <T> > onChanged) : base(effectiveObject, pathItem, onChanged) { Ancestors.Add(CreateSubscriber(effectiveObject, pathItem.Ancestor, onChanged)); }