private void m_lnkelement_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { if (ListeRelations.Count == 0) { return; } CObjetDonneeAIdNumeriqueAuto objet = null; if (ListeRelations.Count > 1) { ArrayList lst = new ArrayList(); foreach (CRelationEntreeAgenda_ElementAAgenda rel in ListeRelations) { lst.Add(rel.ElementLie); } Point pt = m_lnkelement.PointToScreen(new Point(0, m_lnkelement.Height)); objet = CFormLinksToElements.SelectObjet((CObjetDonneeAIdNumerique[])lst.ToArray(typeof(CObjetDonneeAIdNumerique)), pt) as CObjetDonneeAIdNumeriqueAuto; } else { objet = ((CRelationEntreeAgenda_ElementAAgenda)ListeRelations[0]).ElementLie as CObjetDonneeAIdNumeriqueAuto; } if (objet != null) { //Type typeForm = CFormFinder.GetTypeFormToEdit(objet.GetType()); //if ( typeForm == null || !typeForm.IsSubclassOf(typeof(CFormEditionStandard))) //{ // CFormAlerte.Afficher("Le système ne sait pas afficher les éléments du type "+m_typeRelation.TypeElementsConvivial, EFormAlerteType.Exclamation); // return; //} //CFormEditionStandard form = (CFormEditionStandard)Activator.CreateInstance(typeForm, new object[]{objet}); //CSc2iWin32DataNavigation.Navigateur.AffichePage ( form ); CReferenceTypeForm refTypeForm = CFormFinder.GetRefFormToEdit(objet.GetType()); if (refTypeForm == null) { CFormAlerte.Afficher(I.T("The system cannot display elements from type @1|30120", m_typeRelation.TypeElementsConvivial), EFormAlerteType.Exclamation); return; } else { CFormEditionStandard form = refTypeForm.GetForm(objet) as CFormEditionStandard; if (form != null) { CSc2iWin32DataNavigation.Navigateur.AffichePage(form); } } } }
public static CObjetDonneeAIdNumerique SelectObjet(CObjetDonneeAIdNumerique[] objets, Point position) { CFormLinksToElements form = new CFormLinksToElements(); form.Location = position; if (form.Right > Screen.PrimaryScreen.WorkingArea.Width) { form.Left -= form.Right - Screen.PrimaryScreen.WorkingArea.Width; } if (form.Bottom > Screen.PrimaryScreen.WorkingArea.Height) { form.Top -= form.Bottom - Screen.PrimaryScreen.WorkingArea.Height; } form.m_wndListe.ListeSource = objets; CObjetDonneeAIdNumerique objet = null; if (form.ShowDialog() == DialogResult.OK) { objet = form.m_objetSel; } form.Dispose(); return(objet); }