private void Design(TextBox tb)
        {
            ExpressionEditor     ee = new ExpressionEditor();
            ExpressionEditorForm f  = null;

            //if (_cell is ICalculateColumn)
            //    f = ee.GetExpressionEditorForm(tb.Text, _cell, "Expression");
            //else
            f = ee.GetExpressionEditorForm(tb.Text, _cell, "Algorithm");
            if (f != null && f.ShowDialog() == DialogResult.OK)
            {
                tb.Text = f.Source;
            }
        }
Exemple #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc == null)
            {
                return(value);
            }
            ExpressionEditorForm dsec = GetExpressionEditorForm(value.ToString(), context.Instance
                                                                , context.PropertyDescriptor.Name);

            if (edSvc.ShowDialog(dsec) == DialogResult.OK)
            {
                return(dsec.Source);
            }
            return(value);
        }
Exemple #3
0
        public ExpressionEditorForm GetExpressionEditorForm(string source, object editobject, string pname)
        {
            ExpressionEditorForm dsec = new ExpressionEditorForm();

            dsec.Source     = source;
            dsec.EditObject = editobject;

            if (editobject is Expression)
            {
                //(editobject as Formula).TypeChanging -= new TypeChangingHandler(ExpressionEditor_TypeChanging);
                //(editobject as Formula).TypeChanging += new TypeChangingHandler(ExpressionEditor_TypeChanging);
                //if ((editobject as Formula).Type == FormulaType.Business)
                //    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.BusinessFunction;
                if ((editobject as Expression).Formula.Type == FormulaType.Common)
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.CommonFunction;
                }
                else if ((editobject as Expression).Formula.Type == FormulaType.UserDefine)
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.UserDefine;
                }
                if ((editobject as Expression).Formula.Type == FormulaType.Filter)
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.Filter;
                }
                dsec.Text = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx5", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
            }
            else// if(editobject is ICalculateColumn)
            {
                if (pname == "UserDefineItem")
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.UserDefine;
                    dsec.Text = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx5", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
                }
                else if (pname == "FilterString")
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.Free;
                    dsec.Text = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx7", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
                }
                else if (pname == "MapKeys")
                {
                    dsec.ScriptType = ScriptType.MapKeys;
                    dsec.Type       = ExpressionDesigner.ExpressionDesigner.EditType.Script;
                    dsec.Text       = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx7", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
                }
                else if (pname == "Expression")
                {
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.ColumnExpression;
                    dsec.Text = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx6", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
                }
                else
                {
                    if (pname == "PrepaintEvent")
                    {
                        dsec.ScriptType = ScriptType.PreEvent;
                    }
                    else if (pname == "InitEvent")
                    {
                        dsec.ScriptType = ScriptType.InitEvent;
                    }
                    else if (pname == "GroupFilter")
                    {
                        dsec.ScriptType = ScriptType.GroupFilter;
                    }
                    else
                    {
                        dsec.ScriptType = ScriptType.Algorithm;
                    }
                    dsec.Type = ExpressionDesigner.ExpressionDesigner.EditType.Script;
                    dsec.Text = UFIDA.U8.UAP.Services.ReportResource.U8ResService.GetResString("U8.UAP.Services.ReportElements.Tx7", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
                }
            }
            return(dsec);
        }