コード例 #1
0
        protected CopiedOptionHandler GetOptionHandler()
        {
            CopiedOptionGroup group = (CopiedOptionGroup)(this as CopiedOptionGroup ?? Owner);

            while (group != null && !(group is CopiedOptionHandler))
            {
                group = group.Owner as CopiedOptionGroup;
            }
            return((CopiedOptionHandler)group);
        }
コード例 #2
0
            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);
                }
            }
コード例 #3
0
        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);
        }
コード例 #4
0
 public WeakGroupListener(CopiedOptionGroup group, IOptionGroup optionGroup)
 {
     this.reference = new WeakReference(group);
     optionGroup.Items.CollectionChanged += new NotifyCollectionChangedEventHandler(Items_CollectionChanged);
 }