Esempio n. 1
0
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            DocDefinition docBase       = this.m_base;
            DocDefinition docDefinition = null;


            // for now, clear it -- future: allow incremental replacement

            CvtValuePath valuepathouter = null;
            CvtValuePath valuepathinner = null;

            // keep building
            while (docBase != null)
            {
                using (FormSelectEntity formEntity = new FormSelectEntity(docBase, docDefinition, this.m_project, SelectDefinitionOptions.Entity | SelectDefinitionOptions.Type))
                {
                    if (formEntity.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && formEntity.SelectedEntity != null)
                    {
                        CvtValuePath valuepath = null;
                        if (formEntity.SelectedEntity is DocEntity)
                        {
                            using (FormSelectAttribute formAttribute = new FormSelectAttribute((DocEntity)formEntity.SelectedEntity, this.m_project, null, false))
                            {
                                if (formAttribute.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && formAttribute.SelectedAttribute != null)
                                {
                                    string item = null;
                                    switch (formAttribute.SelectedAttribute.GetAggregation())
                                    {
                                    case DocAggregationEnum.SET:
                                        // if set collection, then qualify by name
                                        // future: more intelligent UI for picking property sets, properties
                                        using (FormSelectItem formItem = new FormSelectItem())
                                        {
                                            if (formItem.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                                            {
                                                item = formItem.Item;
                                            }
                                        }
                                        break;

                                    case DocAggregationEnum.LIST:
                                        // if list collection, then qualify by index
                                        // future: more intelligent UI for picking list indices
                                        using (FormSelectItem formItem = new FormSelectItem())
                                        {
                                            if (formItem.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                                            {
                                                item = formItem.Item;
                                            }
                                        }
                                        break;
                                    }

                                    // now add entry to listview
                                    valuepath = new CvtValuePath(formEntity.SelectedEntity, formAttribute.SelectedAttribute, item, null);

                                    if (valuepathinner != null)
                                    {
                                        valuepathinner.InnerPath = valuepath;
                                    }
                                    valuepathinner = valuepath;

                                    if (valuepathouter == null)
                                    {
                                        valuepathouter = valuepath;
                                    }

                                    // drill in
                                    if (this.m_map.ContainsKey(formAttribute.SelectedAttribute.DefinedType))
                                    {
                                        docBase = this.m_map[formAttribute.SelectedAttribute.DefinedType] as DocDefinition;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        else if (formEntity.SelectedEntity is DocType)
                        {
                            valuepath = new CvtValuePath(formEntity.SelectedEntity, null, null, null);

                            if (valuepathinner != null)
                            {
                                valuepathinner.InnerPath = valuepath;
                            }
                            valuepathinner = valuepath;

                            if (valuepathouter == null)
                            {
                                valuepathouter = valuepath;
                            }

                            docBase = null;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this.LoadValuePath(valuepathouter);
        }
Esempio n. 2
0
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            DocDefinition docBase = this.m_base;
            DocDefinition docDefinition = null;

            // for now, clear it -- future: allow incremental replacement

            CvtValuePath valuepathouter = null;
            CvtValuePath valuepathinner = null;

            // keep building
            while (docBase != null)
            {
                using (FormSelectEntity formEntity = new FormSelectEntity(docBase, docDefinition, this.m_project, SelectDefinitionOptions.Entity | SelectDefinitionOptions.Type))
                {
                    if (formEntity.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && formEntity.SelectedEntity != null)
                    {
                        CvtValuePath valuepath = null;
                        if (formEntity.SelectedEntity is DocEntity)
                        {
                            using (FormSelectAttribute formAttribute = new FormSelectAttribute((DocEntity)formEntity.SelectedEntity, this.m_project, null, false))
                            {
                                if (formAttribute.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && formAttribute.SelectedAttribute != null)
                                {
                                    string item = null;
                                    switch (formAttribute.SelectedAttribute.GetAggregation())
                                    {
                                        case DocAggregationEnum.SET:
                                            // if set collection, then qualify by name
                                            // future: more intelligent UI for picking property sets, properties
                                            using (FormSelectItem formItem = new FormSelectItem())
                                            {
                                                if (formItem.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                                                {
                                                    item = formItem.Item;
                                                }
                                            }
                                            break;

                                        case DocAggregationEnum.LIST:
                                            // if list collection, then qualify by index
                                            // future: more intelligent UI for picking list indices
                                            using (FormSelectItem formItem = new FormSelectItem())
                                            {
                                                if (formItem.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                                                {
                                                    item = formItem.Item;
                                                }
                                            }
                                            break;
                                    }

                                    // now add entry to listview
                                    valuepath = new CvtValuePath(formEntity.SelectedEntity, formAttribute.SelectedAttribute, item, null);

                                    if (valuepathinner != null)
                                    {
                                        valuepathinner.InnerPath = valuepath;
                                    }
                                    valuepathinner = valuepath;

                                    if (valuepathouter == null)
                                    {
                                        valuepathouter = valuepath;
                                    }

                                    // drill in
                                    if (this.m_map.ContainsKey(formAttribute.SelectedAttribute.DefinedType))
                                    {
                                        docBase = this.m_map[formAttribute.SelectedAttribute.DefinedType] as DocDefinition;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }

                        }
                        else if (formEntity.SelectedEntity is DocType)
                        {
                            valuepath = new CvtValuePath(formEntity.SelectedEntity, null, null, null);

                            if (valuepathinner != null)
                            {
                                valuepathinner.InnerPath = valuepath;
                            }
                            valuepathinner = valuepath;

                            if (valuepathouter == null)
                            {
                                valuepathouter = valuepath;
                            }

                            docBase = null;
                        }

                    }
                    else
                    {
                        break;
                    }

                }
            }

            this.LoadValuePath(valuepathouter);
        }