Beispiel #1
0
        private void setControlsFromDefinition(LayerDefinition definition)
        {
            //Enabled stuff
            removeButton.Enabled   = true;
            moveUpButton.Enabled   = listBox.SelectedIndex > 0;
            moveDownButton.Enabled = listBox.SelectedIndex < listBox.Items.Count - 1;
            nameTextBox.Enabled    = true;
            gridXTextBox.Enabled   = true;
            gridYTextBox.Enabled   = true;
            scrollXTextBox.Enabled = true;
            scrollYTextBox.Enabled = true;
            typeComboBox.Enabled   = true;

            //Load properties
            nameTextBox.Text           = definition.Name;
            gridXTextBox.Text          = definition.Grid.Width.ToString();
            gridYTextBox.Text          = definition.Grid.Height.ToString();
            scrollXTextBox.Text        = definition.ScrollFactor.X.ToString();
            scrollYTextBox.Text        = definition.ScrollFactor.Y.ToString();
            typeComboBox.SelectedIndex = LayerDefinition.LAYER_TYPES.FindIndex(e => e == definition.GetType());

            //Remove the old layer editor
            if (layerEditor != null)
            {
                Controls.Remove(layerEditor);
            }

            //Add the new one
            layerEditor = definition.GetEditor();
            if (layerEditor != null)
            {
                layerEditor.TabIndex = 6;
                Controls.Add(layerEditor);
            }
        }
Beispiel #2
0
        private void setControlsFromDefinition(LayerDefinition definition)
        {
            //Enabled stuff
            removeButton.Enabled      = true;
            moveUpButton.Enabled      = listBox.SelectedIndex > 0;
            moveDownButton.Enabled    = listBox.SelectedIndex < listBox.Items.Count - 1;
            nameTextBox.Enabled       = true;
            gridXTextBox.Enabled      = true;
            gridYTextBox.Enabled      = true;
            scrollXTextBox.Enabled    = true;
            scrollYTextBox.Enabled    = true;
            typeComboBox.Enabled      = true;
            itemGroupComboBox.Enabled = true;

            //Load properties
            nameTextBox.Text           = definition.Name;
            gridXTextBox.Text          = definition.Grid.Width.ToString();
            gridYTextBox.Text          = definition.Grid.Height.ToString();
            scrollXTextBox.Text        = definition.ScrollFactor.X.ToString();
            scrollYTextBox.Text        = definition.ScrollFactor.Y.ToString();
            typeComboBox.SelectedIndex = LayerDefinition.LAYER_TYPES.FindIndex(e => e == definition.GetType());

            //Remove the old layer editor
            if (layerEditor != null)
            {
                Controls.Remove(layerEditor);
            }

            //Add the new one
            layerEditor = definition.GetEditor();
            if (layerEditor != null)
            {
                layerEditor.TabIndex = 6;
                Controls.Add(layerEditor);
            }

            // Get index of group from group name
            var gntemp = groups.groupNames.Where(ob => ob == definition.GroupName);

            itemGroupComboBox.SelectedIndex = (gntemp.Count() > 0 && gntemp.Single() != "") ? itemGroupComboBox.Items.IndexOf(gntemp.Single()) : 0;
        }