Пример #1
0
        public uint[] GetArgValues()
        {
            uint[] arr = new uint[this.parameters.Item.Count];

            for (int i = 0; i < (int)this.parameters.Item.Count; i++)
            {
                PropertyGridEx.CustomProperty property = this.parameters.Item[i];

                // bool type field
                if (property.Type.Name == "Boolean")
                {
                    arr[i] = ((Boolean)property.Value) == true ? 1u : 0u;
                }
                // int type field
                else if (property.Type.Name == "Int32")
                {
                    arr[i] = (uint)((int)property.Value);
                }
                else if (property.Type.Name == "UInt32")
                {
                    arr[i] = (uint)property.Value;
                }
                // enum type field
                else if (property.Type.Name == "String")
                {
                    arr[i] = (uint)property.Choices.LastIndexOf((String)(property.Value));
                }
            }

            return(arr);
        }
        private void PGECampos_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            PropertyGridEx.PropertyGridEx obj   = (PropertyGridEx.PropertyGridEx)s;
            PropertyGridEx.CustomProperty campo = null;
            foreach (PropertyGridEx.CustomProperty c in obj.Item)
            {
                if (c.Name == e.ChangedItem.Label)
                {
                    campo = c;
                    break;
                }
            }

            if (campo != null)
            {
                //Se asigno un campo
                if (((Clases.clsNodoTiny)nodoActual.Tag).tipoNodo == Clases.clsEnums.TipoNodo.Expediente)
                {
                    //Es un expediente
                    Clases.clsCampoDato myCampo = new Clases.clsCampoDato(Clases.clsCampoDato.TipoCampo.Expediente, ((Clases.clsNodoTiny)nodoActual.Tag).idNodo, campo.Tag.ToString());
                    myCampo.valor = campo.Value.ToString();
                    myCampo.guardarDatos();
                }
                else if (((Clases.clsNodoTiny)nodoActual.Tag).tipoNodo == Clases.clsEnums.TipoNodo.Documento)
                {
                    //Es un Documentos Final
                    Clases.clsCampoDato myCampo = new Clases.clsCampoDato(Clases.clsCampoDato.TipoCampo.Documento, PGECampos.Tag.ToString(), campo.Tag.ToString());
                    myCampo.valor = campo.Value.ToString();
                    myCampo.guardarDatos();
                }
            }
        }
Пример #3
0
        public void RebuildArgsTable()
        {
            if (this.oldValues == null)
            {
                this.oldValues = this.GetArgValues();
            }

            this.parameters.Item.Clear();

            int i = 0;

            foreach (ScriptArg arg in ggen.Args)
            {
                PropertyGridEx.CustomProperty property = null;

                if (arg.Type == ScriptArgType.Bool)
                {
                    property = new PropertyGridEx.CustomProperty(arg.Label, arg.Default == 1 ? true : false, false, "Script parameters:", arg.Description, true);

                    if (oldValues.Length > i)
                    {
                        property.Value = oldValues[i] == 1 ? true : false;
                    }
                }
                else if (arg.Type == ScriptArgType.Int)
                {
                    property = new PropertyGridEx.CustomProperty(arg.Label, (UInt32)arg.Default, false, "Script parameters:", arg.Description, true);

                    if (oldValues.Length > i)
                    {
                        property.Value = (uint)(Math.Max(Math.Min(oldValues[i], arg.Maximum), arg.Minimum));
                    }
                }
                else if (arg.Type == ScriptArgType.Enum)
                {
                    property         = new PropertyGridEx.CustomProperty(arg.Label, arg.Options.ElementAt((int)arg.Default), false, "Script parameters:", arg.Description, true);
                    property.Choices = new PropertyGridEx.CustomChoices(arg.Options.ToArray(), false);

                    if (oldValues.Length > i)
                    {
                        property.Value = arg.Options.Count() > oldValues[i] ? arg.Options.ElementAt((int)oldValues[i]) : arg.Options.ElementAt((int)arg.Default);
                    }
                }

                if (property != null)
                {
                    this.parameters.Item.Add(property);
                }

                i++;
            }

            this.oldValues = null;

            this.parameters.Refresh();
        }
        //动作属性窗口鼠标单击响应
        private object CustomActionItem_OnClick(object sender, EventArgs e)
        {
            PropertyGridEx.CustomProperty prop = (PropertyGridEx.CustomProperty)((PropertyGridEx.CustomProperty.CustomPropertyDescriptor)sender).CustomProperty;
            VarForm form = new VarForm();

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                prop.Value = form.VarExpress;
            }
            form.Dispose();
            return(prop.Value);
        }
        //事件属性窗口鼠标单击响应
        private object CustomEventItem_OnClick(object sender, EventArgs e)
        {
            PropertyGridEx.CustomProperty prop = (PropertyGridEx.CustomProperty)((PropertyGridEx.CustomProperty.CustomPropertyDescriptor)sender).CustomProperty;
            EventSet form = new EventSet();
            string   stmp = prop.Value.ToString();

            if (stmp == "")
            {
                form.sComboxContent = "";
                form.sContent       = "";
            }
            else
            {
                string[] EventContent;
                if (stmp.Length > 0)
                {
                    EventContent = stmp.Split('+');
                    if (EventContent.Length == 2)//打开画面
                    {
                        form.sComboxContent = EventContent[0];
                        form.sContent       = EventContent[1];
                    }
                    else if (EventContent.Length == 3)//写变量值
                    {
                        form.sComboxContent = EventContent[0];
                        form.sContent       = EventContent[1] + "+" + EventContent[2];
                    }
                }
            }
            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                if (form.sComboxContent == "")
                {
                    prop.Value = "";
                }
                else
                {
                    if (form.sContent == "")
                    {
                        MessageBox.Show("没有事件内容!");
                        form.Dispose();
                        return(prop.Value);
                    }
                    prop.Value = form.sComboxContent + "+" + form.sContent;
                }
            }
            form.Dispose();
            return(prop.Value);
        }
Пример #6
0
        public void RebuildArgsTable()
        {
            if (this.oldValues == null) this.oldValues = this.GetArgValues();

            this.parameters.Item.Clear();

            int i = 0;
            foreach (ScriptArg arg in ggen.Args)
            {
                PropertyGridEx.CustomProperty property = null;

                if (arg.Type == ScriptArgType.Bool)
                {
                    property = new PropertyGridEx.CustomProperty(arg.Label, arg.Default == 1 ? true : false, false, "Script parameters:", arg.Description, true);

                    if (oldValues.Length > i) property.Value = oldValues[i] == 1 ? true : false;
                }
                else if (arg.Type == ScriptArgType.Int)
                {
                    property = new PropertyGridEx.CustomProperty(arg.Label, (UInt32) arg.Default, false, "Script parameters:", arg.Description, true);

                    if (oldValues.Length > i) property.Value = (uint) (Math.Max(Math.Min(oldValues[i], arg.Maximum), arg.Minimum));
                }
                else if (arg.Type == ScriptArgType.Enum)
                {
                    property = new PropertyGridEx.CustomProperty(arg.Label, arg.Options.ElementAt((int) arg.Default), false, "Script parameters:", arg.Description, true);
                    property.Choices = new PropertyGridEx.CustomChoices(arg.Options.ToArray(), false);

                    if (oldValues.Length > i) property.Value = arg.Options.Count() > oldValues[i] ? arg.Options.ElementAt((int)oldValues[i]) : arg.Options.ElementAt((int)arg.Default);
                }

                if (property != null)
                {
                    this.parameters.Item.Add(property);
                }

                i++;
            }

            this.oldValues = null;

            this.parameters.Refresh();
        }