Ejemplo n.º 1
0
        private void DrawTree(IEnumerable<LineageCoords> treePlot, ReadOnlyLineage root, int? selectedLineageId)
        {
            foreach (LineageCoords plot in treePlot)
            {
                var linCtrl = new LineageControl(plot);
                if (selectedLineageId.HasValue && plot.LineageId == selectedLineageId.Value)
                    linCtrl.IsSelected = true;
                linCtrl.RenderTransform = LineageTransformGroup;
                Canvas.SetTop(linCtrl, plot.AbsoluteOriginY);
                Canvas.SetLeft(linCtrl, plot.AbsoluteOriginX);

                _lineageIdLookup.Add(linCtrl, plot.LineageId);
                linCtrl.Selected += LinCtrl_Selected;
                linCtrl.NavigateRequest += linCtrl_NavigateRequest;

                TreeCanvas.Children.Add(linCtrl);
                if (plot.LineageId == root.Id && root.ParentLineageId.HasValue)
                {
                    AddGoToParentButton(plot);
                    AddResetButton(plot);
                }
                //TODO: Try to give canvas focus on tree load so that it'll respond to mouse wheel events
                //if (plot.LineageId == root.Id && selectedLineageId == null)
                //{
                //    Dispatcher.BeginInvoke(() => { linCtrl.Focus(); });
                //}
            }
        }
Ejemplo n.º 2
0
 public bool IsInHierarchy(LineageControl lc)
 {
     return LineageInfo.SelfAndAllChildren.Contains(lc.LineageInfo);
 }