BuildTree() public static méthode

public static BuildTree ( IEnumerable lanes, IEnumerable host_lanes ) : LaneTreeNode,
lanes IEnumerable
host_lanes IEnumerable
Résultat LaneTreeNode,
Exemple #1
0
    private void CreateTree()
    {
        if (this.response != null)
        {
            return;
        }

        // we need to create a tree of the lanes
        LaneTreeNode root;
        Panel        div;

        // Remove disabled lanes.
        var lanes = new List <DBLane> (tree_response.Lanes);

        for (int i = lanes.Count - 1; i >= 0; i--)
        {
            if (lanes [i].enabled)
            {
                continue;
            }
            lanes.RemoveAt(i);
        }
        root = LaneTreeNode.BuildTree(lanes, null);

        SetResponse(tree_response);

        // layout the tree
        div    = new Panel();
        div.ID = "tree_root_id";

        tableMainTree.Rows.Add(Utils.CreateTableRow(CreateTreeViewRow("index.aspx?show_all=true", "All", 0, root.Depth, true, div, true)));

        tableMainTree.Rows.Add(Utils.CreateTableRow(div));
        WriteTree(root, tableMainTree, 1, root.Depth, div);

        // layout the tags
        div    = new Panel();
        div.ID = "tags_root_id";

        tableMainTree.Rows.Add(Utils.CreateTableRow(CreateTreeViewRow(null, "Tags", 0, 1, true, div, true)));
        tableMainTree.Rows.Add(Utils.CreateTableRow(div));
        WriteTags(tree_response.Tags, tableMainTree, 1, div);
    }
    private void CreateTree()
    {
        if (this.response != null)
        {
            return;
        }

        GetLanesResponse response;
        // we need to create a tree of the lanes
        LaneTreeNode root;
        Panel        div;

        try {
            response = WebService.GetLanes(WebServiceLogin);

            // Reomve disabled lanes.
            var lanes = new List <DBLane> (response.Lanes);
            for (int i = lanes.Count - 1; i >= 0; i--)
            {
                if (lanes [i].enabled)
                {
                    continue;
                }
                lanes.RemoveAt(i);
            }
            root = LaneTreeNode.BuildTree(lanes, null);

            SetResponse(response);

            div    = new Panel();
            div.ID = "tree_root_id";

            // layout the tree
            tableMainTree.Rows.Add(Utils.CreateTableRow(CreateTreeViewRow("index.aspx?show_all=true", "All", 0, root.Depth, true, div, true)));

            tableMainTree.Rows.Add(Utils.CreateTableRow(div));
            WriteTree(root, tableMainTree, 1, root.Depth, div);
        } catch {
            tableMainTree.Visible = false;
        }
    }
Exemple #3
0
    private LaneTreeNode BuildTree(FrontPageResponse data)
    {
        LaneTreeNode result = LaneTreeNode.BuildTree(data.Lanes, data.HostLanes);

        if (data.Lane != null)
        {
            result = result.Find(v => v.Lane != null && v.Lane.id == data.Lane.id);
        }
        else if (data.SelectedLanes.Count > 1)
        {
            for (int i = result.Children.Count - 1; i >= 0; i--)
            {
                LaneTreeNode ltn = result.Children [i];
                if (!data.SelectedLanes.Exists((DBLane l) => l.id == ltn.Lane.id))
                {
                    result.Children.RemoveAt(i);
                }
            }
        }
        return(result);
    }