Ejemplo n.º 1
0
 protected virtual void OnModelChanged(TimelineTrackModelChangedEventArgs e)
 {
     if (e.OldModel != null)
     {
         e.OldModel.TrackNameChanged -= this.model_TrackNameChanged;
     }
     if (e.Model != null)
     {
         e.Model.TrackNameChanged += this.model_TrackNameChanged;
     }
     this.UpdateContentWidth();
     this.Invalidate();
 }
        protected override void OnModelChanged(TimelineTrackModelChangedEventArgs e)
        {
            if (e.OldModel != null)
            {
                ITimelineGraphTrackModel oldModel = e.OldModel as ITimelineGraphTrackModel;

                oldModel.GraphsAdded -= this.model_GraphsAdded;
                oldModel.GraphsRemoved -= this.model_GraphsRemoved;
                oldModel.GraphChanged -= this.model_GraphChanged;

                if (oldModel.Graphs.Any())
                {
                    this.OnModelGraphsRemoved(new TimelineGraphCollectionEventArgs(oldModel.Graphs));
                }
            }
            if (e.Model != null)
            {
                ITimelineGraphTrackModel newModel = e.Model as ITimelineGraphTrackModel;

                if (newModel.Graphs.Any())
                {
                    this.OnModelGraphsAdded(new TimelineGraphCollectionEventArgs(newModel.Graphs));
                }

                newModel.GraphsAdded += this.model_GraphsAdded;
                newModel.GraphsRemoved += this.model_GraphsRemoved;
                newModel.GraphChanged += this.model_GraphChanged;
            }
            base.OnModelChanged(e);
            this.AdjustVerticalUnits(AdjustVerticalMode.GrowAndShrink);
        }