コード例 #1
0
        /// //////////////////////////////////////////
        protected override sc2i.common.CResultAErreur MAJ_Champs()
        {
            CResultAErreur result = base.MAJ_Champs();

            OnChangeVariable();

            if (!(m_cmbProcess.SelectedValue is CProcessInDb))
            {
                result.EmpileErreur(I.T("Select an action|30014"));
            }

            CProcessInDb processInDB = (CProcessInDb )m_cmbProcess.SelectedValue;

            ActionLancerProcess.DbKeyProcess = processInDB.DbKey;

            ActionLancerProcess.ClearExpressionsVariables();
            foreach (string strIdVariable in m_tableIdVariableToFormule.Keys)
            {
                C2iExpression exp = (C2iExpression)m_tableIdVariableToFormule[strIdVariable];
                if (exp != null)
                {
                    ActionLancerProcess.SetExpressionForVariableProcess(strIdVariable, exp);
                }
            }

            ActionLancerProcess.ModeAsynchrone            = m_chkAsynchrone.Checked;
            ActionLancerProcess.SansTrace                 = m_chkSansTrace.Checked;
            ActionLancerProcess.LancerDansUnProcessSepare = m_chkContexteSepare.Checked ||
                                                            !processInDB.Process.PeutEtreExecuteSurLePosteClient;

            CActionPointEntree actionEntree = m_cmbPointEntree.SelectedValue as CActionPointEntree;

            if (actionEntree != null)
            {
                ActionLancerProcess.IdPointEntree = actionEntree.IdObjetProcess;
            }
            else
            {
                ActionLancerProcess.IdPointEntree = -1;
            }
            return(result);
        }
コード例 #2
0
        /// ////////////////////////////////////////////////////////////////
        private void CControlEditionProcess_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point   ptMouseUp      = new Point(e.X, e.Y);
            Point   ptSouris       = GetLogicalPointFromDisplay(ptMouseUp);
            CAction nouvelleAction = null;

            switch (ModeEdition)
            {
            case EModeEditeurProcess.Action:
                if (InfoActionACree != null)
                {
                    try
                    {
                        nouvelleAction = (CAction)Activator.CreateInstance(InfoActionACree.TypeAction, new object[] { ProcessEdite });
                    }
                    catch (Exception exp)
                    {
                        throw new Exception(I.T("Error while allocationg an action from type @1|30001", InfoActionACree.TypeAction.ToString()), exp);
                    }
                }
                break;

            case EModeEditeurProcess.Condition:
                nouvelleAction = new CActionCondition(ProcessEdite);
                break;

            case EModeEditeurProcess.EntryPoint:
                nouvelleAction = new CActionPointEntree(ProcessEdite);
                break;

            case EModeEditeurProcess.Jonction:
                nouvelleAction = new CActionJonction(ProcessEdite);
                break;

            case EModeEditeurProcess.Lien1:
                m_actionDebutLien = ProcessEdite.GetActionFromPoint(ptSouris);

                if (m_actionDebutLien != null)
                {
                    CLienAction[] liensTest = m_actionDebutLien.GetLiensSortantsPossibles();
                    if (liensTest.Length == 0)
                    {
                        CFormAlerte.Afficher(I.T("Impossible to add an output link to the action|30002"), EFormAlerteType.Erreur);
                        return;
                    }
                    ModeEdition = EModeEditeurProcess.Lien2;
                }
                break;

            case EModeEditeurProcess.Lien2:
                ModeEdition = EModeEditeurProcess.Lien1;
                CAction action = ProcessEdite.GetActionFromPoint(ptSouris);
                if (action != m_actionDebutLien && action != null)
                {
                    CLienAction[] liens = m_actionDebutLien.GetLiensSortantsPossibles();
                    if (liens.Length == 0)
                    {
                        CFormAlerte.Afficher(I.T("Impossible to add an output link to the action|30002"), EFormAlerteType.Erreur);
                        return;
                    }
                    CLienAction lien = null;
                    if (liens.Length == 1)
                    {
                        lien = liens[0];
                    }
                    else
                    {
                        Point ptEcran = this.PointToScreen(ptMouseUp);
                        lien = CFormSelectLienSortant.SelectLien(liens, ptEcran);
                    }
                    if (lien == null)
                    {
                        ModeEdition = EModeEditeurProcess.Lien2;
                        return;
                    }
                    if (CEditeurActionsEtLiens.EditeObjet(lien))
                    {
                        lien.ActionDepart  = m_actionDebutLien;
                        lien.ActionArrivee = action;
                        ProcessEdite.AddLien(lien);
                        Selection.Clear();
                        RefreshSelectionChanged = true;
                        if (AfterAddElementToProcess != null)
                        {
                            AfterAddElementToProcess(this, new EventArgs());
                        }
                    }
                    ModeEdition = EModeEditeurProcess.Lien1;
                }
                break;
            }
            if (nouvelleAction != null)
            {
                if (CEditeurActionsEtLiens.EditeObjet(nouvelleAction))
                {
                    ProcessEdite.AddAction(nouvelleAction);
                    Point pt = new Point(ptSouris.X - nouvelleAction.Size.Width / 2, ptSouris.Y - nouvelleAction.Size.Height / 2);
                    nouvelleAction.Position = pt;
                    ModeEdition             = EModeEditeurProcess.Selection;
                    RefreshSelectionChanged = false;
                    Selection.Clear();
                    RefreshSelectionChanged = true;
                    Selection.Add(nouvelleAction);
                    if (AfterAddElementToProcess != null)
                    {
                        AfterAddElementToProcess(this, new EventArgs());
                    }
                }
            }
        }