Exemplo n.º 1
0
        private void m_mnuStockInVariable_Click(object sender, EventArgs e)
        {
            if (Selection.Count != 1 || AskCreationVariable == null)
            {
                return;
            }
            CRepresentationExpressionGraphique rep = Selection[0] as CRepresentationExpressionGraphique;

            if (rep == null || rep.Formule == null)
            {
                return;
            }
            CTypeResultatExpression typeRes = rep.Formule.TypeDonnee;
            CDefinitionProprieteDynamiqueVariableFormule def = new CDefinitionProprieteDynamiqueVariableFormule(
                "", typeRes, true);

            def = CFormEditVariableFormule.EditeVariable(def);
            if (def != null)
            {
                if (AskCreationVariable(def))
                {
                    C2iExpressionSetVariable exp    = new C2iExpressionSetVariable();
                    C2iExpressionChamp       expVar = new C2iExpressionChamp(def);
                    exp.Parametres.Add(expVar);
                    exp.Parametres.Add(rep.Formule);
                    rep.Formule = exp;
                    Refresh();
                }
            }
        }
Exemplo n.º 2
0
        public static CParametreFonctionDynamique EditeParametreFonction(CParametreFonctionDynamique parametre)
        {
            if (parametre == null)
            {
                return(null);
            }
            CFormEditVariableFormule form = new CFormEditVariableFormule();

            if (parametre != null)
            {
                form.m_txtNom.Text      = parametre.Nom;
                form.m_txtType.Text     = DynamicClassAttribute.GetNomConvivial(parametre.TypeResultatExpression.TypeDotNetNatif);
                form.m_chkArray.Checked = parametre.TypeResultatExpression.IsArrayOfTypeNatif;
            }
            else
            {
                parametre = new CParametreFonctionDynamique();
            }
            form.m_parametre = parametre;
            CParametreFonctionDynamique retour = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                retour = form.m_parametre;
            }
            form.Dispose();
            return(retour);
        }
        //-----------------------------------------------------------
        private void m_lnkAddVar_LinkClicked(object sender, EventArgs e)
        {
            CDefinitionProprieteDynamiqueVariableFormule variable = CFormEditVariableFormule.EditeVariable(null);

            if (variable != null && RepresentationEditee != null)
            {
                RepresentationEditee.AddVariable(variable);
                UpdateVariables();
            }
        }
        //--------------------------------------------------------------------
        private void AddVariable(Type typeVariable)
        {
            CParametreFonctionDynamique parametre = new CParametreFonctionDynamique();

            parametre.TypeResultatExpression = new CTypeResultatExpression(typeVariable, false);
            parametre = CFormEditVariableFormule.EditeParametreFonction(parametre);
            if (parametre != null)
            {
                ListViewItem item = new ListViewItem();
                FillItem(item, parametre);
                m_wndListeParametres.Items.Add(item);
                UpdateParametres();
            }
        }
        private void m_wndListeVariables_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = m_wndListeVariables.HitTest(e.X, e.Y);

            if (info != null)
            {
                CDefinitionProprieteDynamiqueVariableFormule def = info.Item.Tag as CDefinitionProprieteDynamiqueVariableFormule;
                if (def != null)
                {
                    CDefinitionProprieteDynamiqueVariableFormule newDef = CFormEditVariableFormule.EditeVariable(def);
                    if (newDef != null)
                    {
                        RepresentationEditee.ReplaceVariable(def, newDef);
                        UpdateVariables();
                    }
                }
            }
        }
        //--------------------------------------------------------------------
        private void m_wndListeVariables_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = m_wndListeParametres.HitTest(e.X, e.Y);

            if (info != null)
            {
                CParametreFonctionDynamique parametre = info.Item.Tag as CParametreFonctionDynamique;
                if (parametre != null)
                {
                    CParametreFonctionDynamique newParam = CFormEditVariableFormule.EditeParametreFonction(parametre);
                    if (newParam != null)
                    {
                        FillItem(info.Item, newParam);
                        UpdateParametres();
                    }
                }
            }
        }
Exemplo n.º 7
0
        public static CDefinitionProprieteDynamiqueVariableFormule EditeVariable(CDefinitionProprieteDynamiqueVariableFormule variable)
        {
            CFormEditVariableFormule form = new CFormEditVariableFormule();

            if (variable != null)
            {
                form.m_txtNom.Text      = variable.Nom;
                form.m_txtType.Text     = DynamicClassAttribute.GetNomConvivial(variable.TypeDonnee.TypeDotNetNatif);
                form.m_chkArray.Checked = variable.TypeDonnee.IsArrayOfTypeNatif;
            }
            else
            {
                variable = new CDefinitionProprieteDynamiqueVariableFormule();
            }
            form.m_variable = variable;
            CDefinitionProprieteDynamiqueVariableFormule retour = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                retour = form.m_variable;
            }
            form.Dispose();
            return(retour);
        }