protected virtual void OnModelGraphsRemoved(TimelineGraphCollectionEventArgs e)
        {
            foreach (ITimelineGraphModel graphModel in e.Graphs)
            {
                TimelineViewGraph graph = this.GetGraphByModel(graphModel);
                if (graph == null) continue;

                graph.ParentTrack = null;
                graph.Model = null;
                this.graphList.Remove(graph);
            }

            this.Invalidate();
            this.UpdateContentWidth();
            this.AdjustVerticalUnits(AdjustVerticalMode.Shrink);
        }
 private void model_GraphsRemoved(object sender, TimelineGraphCollectionEventArgs e)
 {
     this.OnModelGraphsRemoved(e);
 }
        protected virtual void OnModelGraphsAdded(TimelineGraphCollectionEventArgs e)
        {
            foreach (ITimelineGraphModel graphModel in e.Graphs)
            {
                TimelineViewGraph graph = this.GetGraphByModel(graphModel);
                if (graph != null) continue;

                // Determine Type of the TimelineViewTrack matching the TimelineTrackModel
                if (availableViewGraphTypes == null)
                {
                    availableViewGraphTypes = ReflectionHelper.FindConcreteTypes(typeof(TimelineViewGraph));
                }
                Type viewGraphType = null;
                foreach (Type graphType in availableViewGraphTypes)
                {
                    foreach (TimelineModelViewAssignmentAttribute attrib in graphType.GetCustomAttributes(true).OfType<TimelineModelViewAssignmentAttribute>())
                    {
                        foreach (Type validModelType in attrib.ValidModelTypes)
                        {
                            if (validModelType.IsInstanceOfType(graphModel))
                            {
                                viewGraphType = graphType;
                                break;
                            }
                        }
                        if (viewGraphType != null) break;
                    }
                    if (viewGraphType != null) break;
                }
                if (viewGraphType == null) continue;

                // Create TimelineViewTrack accordingly
                graph = viewGraphType.CreateInstanceOf() as TimelineViewGraph;
                graph.Model = graphModel;
                graph.BaseColor = this.GetDefaultGraphColor(this.graphList.Count);

                this.graphList.Add(graph);
                graph.ParentTrack = this;
            }

            this.Invalidate();
            this.UpdateContentWidth();
            this.AdjustVerticalUnits(AdjustVerticalMode.Grow);
        }