Exemple #1
0
 protected virtual void OnChildrenSourceChanged(IEnumerable oldValue, IEnumerable newValue)
 {
     if (this.Scale == null)
     {
         this.Children.Clear();
         if (newValue == null)
         {
             return;
         }
         foreach (object businessObject in newValue)
         {
             Category category = new Category()
             {
                 Scale = this.Scale
             };
             this.Scale.Binder.Bind(category, businessObject);
             this.Children.Add(category);
         }
     }
     else
     {
         if (this._childrenAdapter == null)
         {
             this._childrenAdapter            = new ObservableCollectionListSynchronizer <Category>();
             this._childrenAdapter.TargetList = (IList <Category>) this._children;
             this._childrenAdapter.CreateItem = (Func <object, Category>)(item =>
             {
                 Category category = new Category()
                 {
                     Scale = this.Scale
                 };
                 this.Scale.Binder.Bind(category, item);
                 return(category);
             });
             this._childrenAdapter.StartUpdating = (Action)(() =>
             {
                 if (this.Scale == null)
                 {
                     return;
                 }
                 this.Scale.BeginInit();
             });
             this._childrenAdapter.EndUpdating = (Action)(() =>
             {
                 if (this.Scale == null)
                 {
                     return;
                 }
                 this.Scale.EndInit();
             });
             this._childrenAdapter.ResetItems = (Action)(() => this.Scale.InvalidateTree());
         }
         this._childrenAdapter.SourceCollection = newValue;
     }
 }
Exemple #2
0
 protected virtual void OnChildrenSourceChanged(IEnumerable oldValue, IEnumerable newValue)
 {
     if (this.Scale == null)
     {
         this.Children.Clear();
         if (newValue == null)
             return;
         foreach (object businessObject in newValue)
         {
             Category category = new Category()
             {
                 Scale = this.Scale
             };
             this.Scale.Binder.Bind(category, businessObject);
             this.Children.Add(category);
         }
     }
     else
     {
         if (this._childrenAdapter == null)
         {
             this._childrenAdapter = new ObservableCollectionListSynchronizer<Category>();
             this._childrenAdapter.TargetList = (IList<Category>)this._children;
             this._childrenAdapter.CreateItem = (Func<object, Category>)(item =>
            {
                Category category = new Category()
                {
                    Scale = this.Scale
                };
                this.Scale.Binder.Bind(category, item);
                return category;
            });
             this._childrenAdapter.StartUpdating = (Action)(() =>
            {
                if (this.Scale == null)
                    return;
                this.Scale.BeginInit();
            });
             this._childrenAdapter.EndUpdating = (Action)(() =>
            {
                if (this.Scale == null)
                    return;
                this.Scale.EndInit();
            });
             this._childrenAdapter.ResetItems = (Action)(() => this.Scale.InvalidateTree());
         }
         this._childrenAdapter.SourceCollection = newValue;
     }
 }