//------------------------------------------------------- protected override void MyDraw(CContextDessinObjetGraphique ctx) { if (!m_prj.IsValide()) { return; } Graphics g = ctx.Graphic; foreach (I2iObjetGraphique objet in m_listeChilds) { if (objet is CWndProjetBrique && m_prj.AfficherMiniature && !m_bMiniature) { CWndProjetBrique prj = (CWndProjetBrique)objet; g.DrawImageUnscaled(prj.Miniature, new Rectangle(prj.Position.X, prj.Position.Y, prj.Projet.DesignerProjetWidth, prj.Projet.DesignerProjetHeight)); Rectangle rect = new Rectangle(prj.Position.X, prj.Position.Y, prj.Projet.DesignerProjetWidth, prj.Projet.DesignerProjetHeight); Pen pen = new Pen(Color.Black); g.DrawRectangle(pen, rect); pen.Dispose(); } else { objet.Draw(ctx); } } }
//-------------------------------------------------- public static CWndProjetDetail GetNewWnd(CProjet projet) { CWndProjetDetail wnd = new CWndProjetDetail(projet); Dictionary <CProjet, CWndProjetBrique> tableProjets = new Dictionary <CProjet, CWndProjetBrique>(); CListeObjetsDonnees prjs = projet.ProjetsFils; foreach (CProjet p in prjs) { CWndProjetBrique wndPrj = new CWndProjetBrique(p); tableProjets.Add(p, wndPrj); wnd.AddChild(wndPrj); } Dictionary <CIntervention, CWndIntervention> tableInters = new Dictionary <CIntervention, CWndIntervention>(); CListeObjetsDonnees inters = projet.Interventions; foreach (CIntervention i in inters) { CWndIntervention wndInter = new CWndIntervention(i); tableInters.Add(i, wndInter); wnd.AddChild(wndInter); } CListeObjetsDonnees liens = projet.LiensDuProjet; foreach (CLienDeProjet l in liens) { CWndLienDeProjet wndLien = new CWndLienDeProjet(l); if (l.ElementA is CIntervention) { //SC 20/05/08 : si l'inter n'existe pas, on ne crée pas le wndLien if (tableInters.ContainsKey((CIntervention)l.ElementA)) { wndLien.ElementDepart = tableInters[(CIntervention)l.ElementA]; } else { continue; } } else if (l.ElementA is CProjet) { //SC 20/05/08 : si le projet n'existe pas, on ne crée pas le wndLien if (tableProjets.ContainsKey((CProjet)l.ElementA)) { wndLien.ElementDepart = tableProjets[(CProjet)l.ElementA]; } else { continue; } } else { continue; } if (l.ElementB is CIntervention) { //SC 20/05/08 : si l'inter n'existe pas, on ne crée pas le wndLien if (tableInters.ContainsKey((CIntervention)l.ElementB)) { wndLien.ElementArrivee = tableInters[(CIntervention)l.ElementB]; } else { continue; } } else if (l.ElementB is CProjet) { //SC 20/05/08 : si le projet n'existe pas, on ne crée pas le wndLien if (tableProjets.ContainsKey((CProjet)l.ElementB)) { wndLien.ElementArrivee = tableProjets[(CProjet)l.ElementB]; } else { continue; } } else { continue; } wnd.AddChild(wndLien); } return(wnd); }