public bool AfterDrawElement(CContextDessinObjetGraphique ctx, C2iObjetGraphique objetGraphique) { C2iObjetDeSchema objetDessine = objetGraphique as C2iObjetDeSchema; if (objetDessine == null || objetDessine.ElementDeSchema == null) { return(true); } IElementDeSchemaReseau elementDeSchema = objetDessine.ElementDeSchema.ElementAssocie; if (elementDeSchema == null) { return(true); } Type tp = elementDeSchema.GetType(); CParametreRepresentationSymbole parametre = this[tp]; if (parametre == null) { return(true); } parametre.Draw(ctx, elementDeSchema, objetGraphique); return(true); }
//--------------------------------------------------------------------- private DragDropEffects m_arbreConsultation_OnDragNode(object sender, CNodeConsultationHierarchique node) { //if (m_gestionnaireModeEdition.ModeEdition) { IElementDeSchemaReseau element = node.ObjetLie as IElementDeSchemaReseau; if (element != null && m_schemaReseau != null) { if (m_lienEdite != null) { if (element.GetType() == typeof(CLienReseau)) { CLienReseau lien = (CLienReseau)element; if (!m_lienEdite.PeutEtreSupporte(lien)) { CFormAlerte.Afficher(I.T("Cannot add the link because it is already supported by the current link|30385"), EFormAlerteType.Erreur); return(DragDropEffects.None); } if (!m_lienEdite.TypeSupportantPossible(lien)) { CFormAlerte.Afficher(I.T("Cannot add the link because its type is not a possible supporting type for this link type|30400"), EFormAlerteType.Erreur); return(DragDropEffects.None); } } } if (element.GetType() == typeof(CSchemaReseau)) { //CSchemaReseau schema = (CSchemaReseau)element; //if (schema.SchemaParent != null) //{ // CFormAlerte.Afficher(I.T("Cannot add the diagram beacuse it is included in another diagram|30391"),EFormAlerteType.Erreur); // return DragDropEffects.None; //} } /*CElementDeSchemaReseau elementDeSchema = new CElementDeSchemaReseau(m_schemaReseau.ContexteDonnee); * elementDeSchema.CreateNewInCurrentContexte(); * elementDeSchema.ElementAssocie = element; * elementDeSchema.SchemaReseau = m_schemaReseau;*/ C2iObjetDeSchemaTemporairePourDragDropSansElementDeSchema objet = new C2iObjetDeSchemaTemporairePourDragDropSansElementDeSchema(); objet.InitFrom(element); CDonneeDragDropObjetGraphique data = new CDonneeDragDropObjetGraphique(m_arbreConsultation.GetType().ToString(), objet); DataObject dataObj = new DataObject(); dataObj.SetData(data); dataObj.SetData(typeof(CReferenceObjetDonnee), new CReferenceObjetDonnee((CObjetDonnee)element)); DragDropEffects eff = DoDragDrop(dataObj, DragDropEffects.All | DragDropEffects.Link); /* if (eff == DragDropEffects.None) * elementDeSchema.CancelCreate();*/ } } return(DragDropEffects.None); }