/// //////////////////////////////////////////////////////// ///Le data du result contient la liste des actions dégroupées public CResultAErreur Degrouper() { CResultAErreur result = CResultAErreur.True; foreach (IVariableDynamique variable in m_processFils.ListeVariables) { if (!m_processFils.IsVariableDeProcessParent(variable)) { result.EmpileErreur(I.T("Can not ungroup a group with variables|20040")); return(result); } } Dictionary <CAction, CAction> dicCorrespondanceActions = new Dictionary <CAction, CAction>(); foreach (CAction action in m_processFils.Actions) { if (action.GetType() != typeof(CActionDebut)) { CAction newAction = Activator.CreateInstance(action.GetType(), new object[] { Process }) as CAction; CCloner2iSerializable.CopieTo(action, newAction); newAction.Position = new Point(newAction.Position.X + Position.X, newAction.Position.Y + Position.Y); dicCorrespondanceActions[action] = newAction; Process.AddAction(newAction); } } //Crée les liens CLienAction lienDebut = null; CAction startAction = m_processFils.GetActionDebut(); List <CLienAction> lstLiens = new List <CLienAction>(); foreach (CLienAction lien in m_processFils.Liens) { CAction actionDepart = null; CAction actionArrivee = null; if (lien.ActionDepart == startAction) { lienDebut = lien; } else { if (!dicCorrespondanceActions.TryGetValue(lien.ActionDepart, out actionDepart)) { result.EmpileErreur(I.T("An error occured during grouping process|20038")); return(result); } if (!dicCorrespondanceActions.TryGetValue(lien.ActionArrivee, out actionArrivee)) { result.EmpileErreur(I.T("An error occured during grouping process|20038")); return(result); } CLienAction newLien = Activator.CreateInstance(lien.GetType(), new object[] { Process }) as CLienAction; CCloner2iSerializable.CopieTo(lien, newLien); newLien.ActionArrivee = actionArrivee; newLien.ActionDepart = actionDepart; Process.AddLien(newLien); } } //Modifie les liens entrants foreach (CLienAction lien in GetLiensArrivant()) { if (lienDebut == null) { Process.RemoveLien(lien); } else { //Modifie l'action arrivée du lien lien.ActionArrivee = dicCorrespondanceActions[lienDebut.ActionArrivee]; } } CLienAction lienSortant = null; foreach (CLienAction lien in GetLiensSortant()) { if (lien.GetType() == typeof(CLienAction))//Lien simple { lienSortant = lien; } } List <CAction> lstRetour = new List <CAction>(dicCorrespondanceActions.Values); if (lienSortant != null) { foreach (CAction action in lstRetour) { foreach (CLienAction lien in action.GetLiensSortantsPossibles()) { if (!(lien is CLienErreur)) { lien.ActionDepart = action; lien.ActionArrivee = lienSortant.ActionArrivee; Process.AddLien(lien); } } } } Process.RemoveAction(this); result.Data = lstRetour.AsReadOnly(); return(result); }