public ConsoleUIElement(ConsoleUIElementParam param)
        {
            _name   = param.Name;
            _column = Convert.ToInt32(param.Column);
            _row    = Convert.ToInt32(param.Row);
            _height = Convert.ToInt32(param.Height);
            _width  = Convert.ToInt32(param.Width);
            _text   = param.Text;
            this.SetType(param.Type);
            _fontColor        = this.GetConsoleColor(param.FontColor);
            _backgroundColor  = this.GetConsoleColor(param.BackgrounColor);
            _selectedColor    = this.GetConsoleColor(param.SelectedColor);
            _nonSelectedColor = this.GetConsoleColor(param.NonSelectedColor);

            if (param.Options != null)
            {
                _options = param.Options.Split(",");
                for (int i = 0; i < _options.Length; i++)
                {
                    _options[i] = _options[i].Trim();
                }
            }

            _value = Convert.ToInt32(param.Value);
        }
Esempio n. 2
0
        private void getUIElements(YAMLDocument document)
        {
            foreach (YAMLElement yamlElement in document.GetElements())
            {
                ConsoleUIElementParam param = new ConsoleUIElementParam();
                param.Name             = yamlElement.GetPropertyValue(ConsoleUIElement.NAME);
                param.Type             = yamlElement.Name;
                param.Column           = yamlElement.GetPropertyValue(ConsoleUIElement.COLUMN);
                param.Row              = yamlElement.GetPropertyValue(ConsoleUIElement.ROW);
                param.Height           = yamlElement.GetPropertyValue(ConsoleUIElement.HEIGHT);
                param.Width            = yamlElement.GetPropertyValue(ConsoleUIElement.WIDTH);
                param.Text             = yamlElement.GetPropertyValue(ConsoleUIElement.TEXT);
                param.Value            = yamlElement.GetPropertyValue(ConsoleUIElement.VALUE);
                param.FontColor        = yamlElement.GetPropertyValue(ConsoleUIElement.FONT_COLOR);
                param.BackgrounColor   = yamlElement.GetPropertyValue(ConsoleUIElement.BACKGROUND_COLOR);
                param.Options          = yamlElement.GetPropertyValue(ConsoleUIElement.BACKGROUND_COLOR);
                param.SelectedColor    = yamlElement.GetPropertyValue(ConsoleUIElement.SELECTED_COLOR);
                param.NonSelectedColor = yamlElement.GetPropertyValue(ConsoleUIElement.NON_SELECTED_COLOR);
                param.Options          = yamlElement.GetPropertyValue(ConsoleUIElement.OPTIONS);

                ConsoleUIElement element = new ConsoleUIElement(param);
                _elements.Add(element);
            }
        }