public Categorie(string nomCategorie, int docNumber, Systeme lePapa) : base(lePapa._UCDoc) { categorieName = nomCategorie; num = docNumber; _Systeme = lePapa; _Systeme.num += num; _Systeme._Section.num += num; tviTypeDoc = null; lePapa.listeDesCategories.Add(this); ((TagObject)_Systeme.GetTreeViewItem().Tag).nbDoc += num; ((TagObject)_Systeme._Section.GetTreeViewItem().Tag).nbDoc += num; }
private void BW_Menu_ProgressChanged(object sender, ProgressChangedEventArgs e) { string[] workerResult = e.UserState as string[]; int indexSection = this.hasSection(workerResult[0]); if (indexSection != -1) { int indexSysteme = this.listeDesSections[indexSection].hasSysteme(workerResult[1]); if (indexSysteme != -1) { int indexCategorie = this.listeDesSections[indexSection].listeDesSystemes[indexSysteme].hasCategorie(workerResult[2]); if (indexCategorie == -1) { //on ajoute simplement la categorie Categorie aNewCategorie = new Categorie(workerResult[2], int.Parse(workerResult[3]), this.listeDesSections[indexSection].listeDesSystemes[indexSysteme]); this.listeDesSections[indexSection].listeDesSystemes[indexSysteme].GetTreeViewItem().Items.Add(aNewCategorie.GetTreeViewItem()); } } else { //On ajoute systeme et la catégorie Systeme aNewSysteme = new Systeme(workerResult[1], 0, this.listeDesSections[indexSection]); Categorie aNewCategorie = new Categorie(workerResult[2], int.Parse(workerResult[3]), aNewSysteme); this.listeDesSections[indexSection].GetTreeViewItem().Items.Add(aNewSysteme.GetTreeViewItem()); aNewSysteme.GetTreeViewItem().Items.Add(aNewCategorie.GetTreeViewItem()); } } else { //On ajoute tout Section aNewSection = new Section(workerResult[0], 0, this); Systeme aNewSysteme = new Systeme(workerResult[1], 0, aNewSection); Categorie aNewCategorie = new Categorie(workerResult[2], int.Parse(workerResult[3]), aNewSysteme); _UCDoc.AddItemToMenu(aNewSection.GetTreeViewItem()); aNewSection.GetTreeViewItem().Items.Add(aNewSysteme.GetTreeViewItem()); aNewSysteme.GetTreeViewItem().Items.Add(aNewCategorie.GetTreeViewItem()); } }