Exemple #1
0
        private void FieldForm_Load(object sender, EventArgs e)
        {
            //Блоки констант
            foreach (string constantsBlockName in Program.Kernel.Conf.ConstantsBlock.Keys)
            {
                comboBoxBlock.Items.Add(constantsBlockName);
            }

            if (comboBoxBlock.Items.Count > 0)
            {
                comboBoxBlock.SelectedItem = comboBoxBlock.Items[0];
            }

            //Типи даних
            foreach (FieldType fieldType in FieldType.DefaultList())
            {
                comboBoxFieldType.Items.Add(fieldType);
            }

            comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[0];
            comboBoxPointer.Enabled        = false;
            comboBoxEnums.Enabled          = false;

            //Список довідників
            foreach (string directoryName in Program.Kernel.Conf.Directories.Keys)
            {
                comboBoxPointer.Items.Add("Довідники." + directoryName);
            }

            //Список документів
            foreach (string documentName in Program.Kernel.Conf.Documents.Keys)
            {
                comboBoxPointer.Items.Add("Документи." + documentName);
            }

            //Список перелічення
            foreach (string enumName in Program.Kernel.Conf.Enums.Keys)
            {
                comboBoxEnums.Items.Add("Перелічення." + enumName);
            }

            if (Constants == null)
            {
                Constants = new ConfigurationConstants();
                textBoxNameInTable.Text = NewNameInTable;
                IsNew = true;

                SelectBlockItem();
            }
            else
            {
                OriginalName   = Constants.Name;
                ConstantsBlock = Constants.Block.BlockName;

                textBoxName.Text        = Constants.Name;
                textBoxNameInTable.Text = Constants.NameInTable;
                textBoxDesc.Text        = Constants.Desc;

                SelectBlockItem();

                for (int i = 0; i < comboBoxFieldType.Items.Count; i++)
                {
                    FieldType fieldType = (FieldType)comboBoxFieldType.Items[i];
                    if (fieldType.ConfTypeName == Constants.Type)
                    {
                        comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[i];
                        break;
                    }
                }

                string confTypeName = ((FieldType)comboBoxFieldType.SelectedItem).ConfTypeName;

                if (confTypeName == "pointer")
                {
                    for (int i = 0; i < comboBoxPointer.Items.Count; i++)
                    {
                        if (Constants.Pointer == comboBoxPointer.Items[i].ToString())
                        {
                            comboBoxPointer.SelectedItem = comboBoxPointer.Items[i];
                            break;
                        }
                    }
                }
                else if (confTypeName == "enum")
                {
                    for (int i = 0; i < comboBoxEnums.Items.Count; i++)
                    {
                        if (Constants.Pointer == comboBoxEnums.Items[i].ToString())
                        {
                            comboBoxEnums.SelectedItem = comboBoxEnums.Items[i];
                            break;
                        }
                    }
                }

                LoadTabularPartsList();

                IsNew = false;
            }
        }
Exemple #2
0
        private void FieldForm_Load(object sender, EventArgs e)
        {
            //Типи даних
            foreach (FieldType fieldType in FieldType.DefaultList())
            {
                comboBoxFieldType.Items.Add(fieldType);
            }

            comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[0];
            comboBoxPointer.Enabled        = false;
            comboBoxEnums.Enabled          = false;

            //Список довідників
            foreach (string directoryName in Program.Kernel.Conf.Directories.Keys)
            {
                comboBoxPointer.Items.Add("Довідники." + directoryName);
            }

            //Список документів
            foreach (string documentName in Program.Kernel.Conf.Documents.Keys)
            {
                comboBoxPointer.Items.Add("Документи." + documentName);
            }

            //Список перелічення
            foreach (string enumName in Program.Kernel.Conf.Enums.Keys)
            {
                comboBoxEnums.Items.Add("Перелічення." + enumName);
            }

            if (ConfigurationObjectField == null)
            {
                ConfigurationObjectField = new ConfigurationObjectField();
                textBoxNameInTable.Text  = NewNameInTable;

                IsNew = true;
            }
            else
            {
                OriginalName = ConfigurationObjectField.Name;

                textBoxName.Text        = ConfigurationObjectField.Name;
                textBoxNameInTable.Text = ConfigurationObjectField.NameInTable;
                textBoxDesc.Text        = ConfigurationObjectField.Desc;

                for (int i = 0; i < comboBoxFieldType.Items.Count; i++)
                {
                    FieldType fieldType = (FieldType)comboBoxFieldType.Items[i];
                    if (fieldType.ConfTypeName == ConfigurationObjectField.Type)
                    {
                        comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[i];
                        break;
                    }
                }

                string confTypeName = ((FieldType)comboBoxFieldType.SelectedItem).ConfTypeName;

                if (confTypeName == "pointer")
                {
                    for (int i = 0; i < comboBoxPointer.Items.Count; i++)
                    {
                        if (ConfigurationObjectField.Pointer == comboBoxPointer.Items[i].ToString())
                        {
                            comboBoxPointer.SelectedItem = comboBoxPointer.Items[i];
                            break;
                        }
                    }
                }
                else if (confTypeName == "enum")
                {
                    for (int i = 0; i < comboBoxEnums.Items.Count; i++)
                    {
                        if (ConfigurationObjectField.Pointer == comboBoxEnums.Items[i].ToString())
                        {
                            comboBoxEnums.SelectedItem = comboBoxEnums.Items[i];
                            break;
                        }
                    }
                }

                checkBoxIsPresentation.Checked = ConfigurationObjectField.IsPresentation;
                checkBoxIsIndex.Checked        = ConfigurationObjectField.IsIndex;

                IsNew = false;
            }
        }