Exemplo n.º 1
0
        private string[] GetInputVariableSchema(string name)
        {
            ActionVariable var = variableActions.Find(name);

            if (var is ActionAttributeObject)
            {
                return(((IMapAttribute)var.Data).Fields.Select(c => c.DisplayName).ToArray());
            }
            else if (var is ActionTableVariable)
            {
                List <string> list = new List <string>();
                foreach (DataColumn c in ((DataTable)var.Data).Columns)
                {
                    list.Add(c.ColumnName);
                }
                return(list.ToArray());
            }
            else if (var is ActionArrayVariable)
            {
                List <string> list = new List <string>();
                list.Add("DataItem");
                return(list.ToArray());
            }
            else
            {
                throw new ApplicationException(string.Format("{0}对于变量数据类型错误", name));
            }
        }
Exemplo n.º 2
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (model == Mode.Add)
            {
                if (string.IsNullOrEmpty(namebox.Text))
                {
                    MessageBox.Show("变量名称不能为空");
                    return;
                }
                if (variableActionModel.Any(c => c.ElementName == namebox.Text))
                {
                    MessageBox.Show(string.Format("已包含变量{0},变量名称不能重复", namebox.Text));
                    return;
                }
                if (typeComboBox.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择变量类型");
                    return;
                }
                if (directComboBox.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择变量方向");
                    return;
                }

                currentVariable = CreateVariable((VarType)typeComboBox.SelectedIndex);
            }
            else
            {
                currentVariable = variableActionModel.Find(namebox.Text);
            }
            GuiToObject(currentVariable);
            if (model == Mode.Add)
            {
                variableActionModel.Add(currentVariable);
                ListViewBind();
                Reset();
            }
            MessageBox.Show("操作成功");
        }