private void AfficheInfosPhase(CWndTypeTypeTicket_TypePhase wndPhase) { ValideInfosPhase(); m_lastInterventionAffichee = wndPhase; if (wndPhase == null) { m_panelDetailPhase.Visible = false; } else { m_panelDetailPhase.Visible = true; m_lblPhase.Text = wndPhase.TypeTicket_TypePhase.TypePhase.Libelle; m_chkPhaseDemarrage.Checked = wndPhase.TypeTicket_TypePhase.IsPointEntree; m_chkPhaseFinale.Checked = wndPhase.TypeTicket_TypePhase.IsPointSortie; } }
/// //////////////////////////////////////////////////////////////// private void CControlEditionPhasesDeTicket_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { Point ptSouris = GetLogicalPointFromDisplay(new Point(e.X, e.Y)); CWndTypeTypeTicket_TypePhase wndNouvellePhase = null; switch (ModeEdition) { case EModeEditeurPhaseTicket.Phase: if (TypePhaseEnCreation != null) { CTypeTicket_TypePhase nouvellePhase; nouvellePhase = new CTypeTicket_TypePhase(WndTypeTicketEdite.TypeTicket.ContexteDonnee); nouvellePhase.CreateNewInCurrentContexte(); nouvellePhase.TypeTicket = WndTypeTicketEdite.TypeTicket; nouvellePhase.TypePhase = TypePhaseEnCreation; wndNouvellePhase = new CWndTypeTypeTicket_TypePhase(nouvellePhase); WndTypeTicketEdite.AddChild(wndNouvellePhase); RefreshSelectionChanged = false; Selection.Clear(); RefreshSelectionChanged = true; Selection.Add(wndNouvellePhase); } break; case EModeEditeurPhaseTicket.Lien1: m_typePhaseDebutLien = WndTypeTicketEdite.GetTypePhaseFromPoint(ptSouris); if (m_typePhaseDebutLien != null) { ModeEdition = EModeEditeurPhaseTicket.Lien2; } break; case EModeEditeurPhaseTicket.Lien2: ModeEdition = EModeEditeurPhaseTicket.Lien1; CWndTypeTypeTicket_TypePhase phase = WndTypeTicketEdite.GetTypePhaseFromPoint(ptSouris); bool bCreer = true; if (phase != null && phase != m_typePhaseDebutLien) { //Vérifie qu'il n'y a pas déjà un lien foreach (I2iObjetGraphique objet in ObjetEdite.Childs) { if (objet is CWndLienTypePhase_TypePhase) { CWndLienTypePhase_TypePhase wndLien = (CWndLienTypePhase_TypePhase)objet; if (wndLien.TypePhaseArrivee == m_typePhaseDebutLien && wndLien.TypePhaseDepart == phase || wndLien.TypePhaseArrivee == phase && wndLien.TypePhaseDepart == m_typePhaseDebutLien) { bCreer = false; } break; } } if (bCreer) { CLienTypePhase lien = new CLienTypePhase(WndTypeTicketEdite.TypeTicket.ContexteDonnee); lien.CreateNewInCurrentContexte(); lien.FromTypePhase = m_typePhaseDebutLien.TypeTicket_TypePhase; lien.ToTypePhase = phase.TypeTicket_TypePhase; CWndLienTypePhase_TypePhase wndLien = new CWndLienTypePhase_TypePhase(); wndLien.Lien = lien; wndLien.TypePhaseDepart = m_typePhaseDebutLien; wndLien.TypePhaseArrivee = phase; WndTypeTicketEdite.AddChild(wndLien); RefreshSelectionChanged = true; Selection.Clear(); RefreshSelectionChanged = false; Selection.Add(wndNouvellePhase); ModeEdition = EModeEditeurPhaseTicket.Lien1; } } break; } if (wndNouvellePhase != null) { Point pt = new Point(ptSouris.X - wndNouvellePhase.Size.Width / 2, ptSouris.Y - wndNouvellePhase.Size.Height / 2); wndNouvellePhase.Position = pt; ModeEdition = EModeEditeurPhaseTicket.Selection; RefreshSelectionChanged = false; Selection.Clear(); RefreshSelectionChanged = true; Selection.Add(wndNouvellePhase); if (AfterAddElementToTypePhase != null) { AfterAddElementToTypePhase(this, new EventArgs()); } } }