private void RegisterData(Treap <DataType> .TreapNode o, DataType data) { MyDisposable.MyDisposableEventHandler disposedEventHandler = null; MyDisposable.HeightChangedEventHandler heightChangedEventHandler = null; disposedEventHandler = new MyDisposable.MyDisposableEventHandler(() => { data.Disposed -= disposedEventHandler; data.HeightChanged -= heightChangedEventHandler; treap.Delete(o); OnTreapLayoutChanged(); OnDataRemoved(data); }); heightChangedEventHandler = new MyDisposable.HeightChangedEventHandler((difference) => { treap.ChangeHeight(o, difference); OnTreapLayoutChanged(); }); data.Disposed += disposedEventHandler; data.HeightChanged += heightChangedEventHandler; OnDataInserted(data); }
protected void ChangeHeight(Treap <DataType> .TreapNode node, double difference) { treap.ChangeHeight(node, difference); }