protected CopiedOptionHandler GetOptionHandler() { CopiedOptionGroup group = (CopiedOptionGroup)(this as CopiedOptionGroup ?? Owner); while (group != null && !(group is CopiedOptionHandler)) { group = group.Owner as CopiedOptionGroup; } return((CopiedOptionHandler)group); }
void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { CopiedOptionGroup group = Target as CopiedOptionGroup; if (group == null || group.GetOptionHandler() == null) { ((INotifyCollectionChanged)sender).CollectionChanged -= Items_CollectionChanged; } if (group != null) { group.Items_CollectionChanged(sender, e); } }
internal CopiedOptionItem CreateCopy(CopiedOptionGroup newParent, IOptionItem itemToCopy) { CopiedOptionItem newItem; if (itemToCopy is IOptionGroup) { CopiedOptionGroup copiedGroup = new CopiedOptionGroup(itemToCopy as IOptionGroup, newParent); newItem = copiedGroup; } else { newItem = new CopiedOptionItem(itemToCopy, newParent); } newItem.AutoAdopt = IsAutoAdopt; newItem.AutoCommit = IsAutoCommit; mapping[itemToCopy] = newItem; return(newItem); }
public WeakGroupListener(CopiedOptionGroup group, IOptionGroup optionGroup) { this.reference = new WeakReference(group); optionGroup.Items.CollectionChanged += new NotifyCollectionChangedEventHandler(Items_CollectionChanged); }