protected override void CalcSelectedObjects() { base.CalcSelectedObjects(); if (!ListView.Id.ToLower().Contains("lookup")) { var rootObjects = collection.List.OfType <ITreeNode>().Where(f => f.Parent == null || !collection.List.Contains(f.Parent)).OfType <Object>().ToList(); SelectedObjects = SelectedObjects.OfType <ITreeNode>().Where(f => f.Parent == null || !collection.List.Contains(f.Parent)).OfType <Object>().ToList(); foreach (var item in rootObjects) { CalcNestedSelectedObjects((item as ITreeNode), SelectedObjects.Contains(item)); } } }
/// <summary> /// Draw all the links of the given node /// </summary> /// <param name="n"></param> /// <param name="g"></param> /// <param name="viewportRect"></param> private void DrawLinksOfNode(Node n, Graphics g, Rectangle viewportRect) { // draw all attached links n.DrawLinks(g, Font, viewportRect, SelectedObjects.OfType <Link>()); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Gets all the selected objects with the specified type. /// </summary> /// <typeparam name="T">Type to select.</typeparam> /// <returns>A collection of selected object instances with the specified type.</returns> // -------------------------------------------------------------------------------------------- public IEnumerable <T> GetSelectedObjects <T>() { return(SelectedObjects.OfType <T>()); }