Esempio n. 1
0
 private void AfficheInfosLien(CWndLienTypePhase_TypePhase wndLien)
 {
     ValideInfosLien();
     m_lastLienAffiche = wndLien;
     if (wndLien == null)
     {
         m_panelLien.Visible = false;
     }
     else
     {
         m_panelLien.Visible = true;
         CLienTypePhase        lien             = wndLien.Lien;
         CTypeTicket_TypePhase typePhaseDepart  = lien.FromTypePhase;
         CTypeTicket_TypePhase typePhaseArrivee = lien.ToTypePhase;
         m_lblPhase1.Text     = typePhaseDepart.TypePhase.Libelle;
         m_lblPhase1.Text     = typePhaseArrivee.TypePhase.Libelle;
         m_wndFormule.Formule = lien.FormuleConditionnelle;
     }
 }
Esempio n. 2
0
        /// ////////////////////////////////////////////////////////////////
        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());
                }
            }
        }