﻿List<Modul> korenoveModuly = GetModulListWithIdParent(lstModul, 0);

foreach(Modul modul in korenoveModuly)
{
    TreeNode treeNode = new TreeNode();
    treeNode.Name = modul.NameModul;
    treeNode.Text = modul.NameModul;
    treeViewModuly.Nodes.Add(treeNode);
}

if (korenoveModuly.Count > 0)
{
    bool existChild = true;
    int idParent = 0;
    while (existChild)
    {
        List<Modul> lstBranchModuls = GetModulListWithIdParent(lstModul, idParent);
        
        if (lstBranchModuls.Count == 0) break;

        foreach (Modul modul in lstBranchModuls)
        {
            TreeNode treeNode = new TreeNode();
            treeNode.Name = modul.NameModul;
            treeNode.ImageIndex = modul.IdModul;
            treeNode.Text = modul.NameModul;                            
            treeViewModuly.Nodes.Add(treeNode);
                                        
        }

    }
}


menuStripMain.Items["btnStripNovy"].Click += new EventHandler(btnStripNovy_Click);
menuStripMain.Items["btnStripEdit"].Click += new EventHandler(btnStripEdit_Click);
menuStripMain.Items["btnStripSmazat"].Click += new EventHandler(btnStripSmazat_Click);


void btnStripNovy_Click(object sender, EventArgs e)
{
    throw new NotImplementedException();
}

void btnStripEdit_Click(object sender, EventArgs e)
{
    throw new NotImplementedException();
}

void btnStripSmazat_Click(object sender, EventArgs e)
{
    throw new NotImplementedException();
}