private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (FormulaDefined != null)
                {
                    //var formulaItems = FormulaInstance.GetFormulaItems(ExpressionEditor.ExpressionText);

                    var arg = new FormulaDefinedArg();
                    arg.Expression           = ExpressionEditor.ExpressionText;
                    arg.ExpressionResultType = (ExpressionEditor.Expression as LambdaExpression).ReturnType;
                    //if (!arg.ExpressionResultType.IsPrimitive && arg.ExpressionResultType != typeof(string))
                    //{
                    //    MessageBox.Show("فرمول باید یک مقدار را برگداند");
                    //    return;
                    //}
                    //arg.FormulaItems = formulaItems;
                    FormulaDefined(this, arg);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void View_FormulaDefined(object sender, FormulaDefinedArg e)
        {
            txtFormula.Text       = e.Expression;
            cmbTypes.SelectedItem = e.ExpressionResultType;

            //Formula.FormulaItems.Clear();
            //Formula.FormulaItems = e.FormulaItems;
            ShowTreeParameters(treeParameters.Items, e.FormulaItems);


            MyProjectManager.GetMyProjectManager.CloseDialog(sender);
            //if (e.FormulaItems != null)
            //{
            //    Formula.FormulaItems.Clear();
            //    foreach (var item in e.FormulaItems)
            //    {
            //        Formula_FormulaParameterDTO param = new Formula_FormulaParameterDTO();
            //        if (item is ExistingFormulaParameter)
            //        {
            //            param.FormulaParameterID = (item as ExistingFormulaParameter).FormulaParameterID;
            //        }
            //        else if (item is ColumnFormulaParameter)
            //        {
            //            param.ColumnID = (item as ColumnFormulaParameter).ColumnID;
            //        }
            //        param.FormulaParameterPath = item.FormulaParameterFullPath;
            //        Formula.Parameters.Add(param);
            //    }

            //}
        }