Example #1
0
        /// <summary>
        /// Retrieves all block ITerminalProperty values.
        /// </summary>
        private void GetScrollableProps()
        {
            propBuf.Clear();
            TextProperty argProperty = null;

            TBlock.GetProperties(propBuf);

            foreach (ITerminalProperty prop in propBuf)
            {
                var control = prop as IMyTerminalControl;

                if (control != null && control.CanUseControl(TBlock))
                {
                    nameBuilder.Clear();
                    GetTooltipName(prop, nameBuilder);

                    if (nameBuilder.Length > 0)
                    {
                        if (prop is ITerminalProperty <StringBuilder> )
                        {
                            var textProp = prop as ITerminalProperty <StringBuilder>;

                            if (textProp.CanAccessValue(TBlock))
                            {
                                if (prop.Id == "ConsoleCommand")
                                {
                                    argProperty = TextProperty.GetProperty(nameBuilder, textProp, this);
                                }
                                else if (prop.Id == "Name" || prop.Id == "CustomName")
                                {
                                    blockProperties.Insert(0, TextProperty.GetProperty(nameBuilder, textProp, this));
                                }
                                else
                                {
                                    blockProperties.Add(TextProperty.GetProperty(nameBuilder, textProp, this));
                                }
                            }
                        }
                        if (prop is IMyTerminalControlCombobox)
                        {
                            var comboBox = prop as IMyTerminalControlCombobox;

                            if (comboBox.CanAccessValue(TBlock, comboItemBuffer))
                            {
                                blockProperties.Add(ComboBoxProperty.GetProperty(nameBuilder, comboBox, comboItemBuffer, this));
                            }
                        }
                        else if (prop is ITerminalProperty <bool> )
                        {
                            var boolProp = prop as ITerminalProperty <bool>;

                            if (boolProp.CanAccessValue(TBlock))
                            {
                                blockProperties.Add(BoolProperty.GetProperty(nameBuilder, boolProp, this));
                            }
                        }
                        else if (prop is ITerminalProperty <float> )
                        {
                            var floatProp = prop as ITerminalProperty <float>;

                            if (floatProp.CanAccessValue(TBlock))
                            {
                                blockProperties.Add(FloatProperty.GetProperty(nameBuilder, floatProp, this));
                            }
                        }
                        else if (prop is ITerminalProperty <Color> )
                        {
                            var colorProp = prop as ITerminalProperty <Color>;

                            if (colorProp.CanAccessValue(TBlock))
                            {
                                blockProperties.Add(ColorProperty.GetProperty(nameBuilder, colorProp, this));
                            }
                        }
                        else if (prop is ITerminalProperty <Vector3> && prop.Id.Contains("Color"))
                        {
                            var colorProp = prop as ITerminalProperty <Vector3>;

                            if (colorProp.CanAccessValue(TBlock))
                            {
                                blockProperties.Add(HsvColorProperty.GetProperty(nameBuilder, colorProp, this));
                            }
                        }
                    }
                }
            }

            if (argProperty != null)
            {
                blockProperties.Add(argProperty);
            }

            blockMembers.AddRange(blockProperties);
            comboItemBuffer.Clear();
        }