public void UpdateFieldValue(string screenName, string fieldName, dynamic value)
        {
            ConsoleScreenRenderer renderer = new ConsoleScreenRenderer();
            ConsoleScreen         screen   = this.GetScreen(screenName);

            if (screen != null)
            {
                ConsoleUIElement element = this.GetScreenElement(screenName, fieldName);
                element.Value = value;
                renderer.RenderUIElement(element, _console);
            }
        }
        public void UpdateFieldText(string screenName, string fieldName, string text)
        {
            ConsoleScreenRenderer renderer = new ConsoleScreenRenderer();
            ConsoleScreen         screen   = this.GetScreen(screenName);

            if (screen != null)
            {
                ConsoleUIElement element = this.GetScreenElement(screenName, fieldName);
                int lenght = element.Text.Length;
                element.Text = ConsoleUIPrimitives.GetRepeatedChars(" ", lenght);
                renderer.RenderUIElement(element, _console);
                element.Text = text;
                renderer.RenderUIElement(element, _console);
            }
        }
Example #3
0
        public void RenderUIElement(ConsoleUIElement element, ConsoleObj console)
        {
            _console = console;
            _element = element;
            switch (element.Type)
            {
            case ConsoleUIElementTypes.COLOR:
                this.renderColor();
                break;

            case ConsoleUIElementTypes.LABEL:
                this.renderLabel();
                break;

            case ConsoleUIElementTypes.BOX:
                this.renderBox();
                break;

            case ConsoleUIElementTypes.TABS:
                this.renderTabs();
                break;
            }
        }
Example #4
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);
            }
        }
        public int GetListElementWidth(ConsoleUIElement element)
        {
            int screenWidth = _console.GetSize().Item1;

            return(Convert.ToInt32(Convert.ToDouble(screenWidth) / Convert.ToDouble(element.Options.Length)));
        }