internal void logInteraction(InputTypes type, string Title, string optional = "")
 {
     if (type != null && Title != null)
     {
         if (optional == null || optional.Equals(String.Empty))
         {
             Console.WriteLine("EditField_EventManager InputTypes:" + type.ToString() + " Current: " + Title);
         }
         else
         {
             Console.WriteLine("EditField_EventManager InputTypes:" + type.ToString() + " Current: " + Title + " Additional Info: " + optional);
         }
     }
 }
Ejemplo n.º 2
0
        internal static void ShowWorking(InputTypes operation, int result, params int[] input)
        {
            // If it is a test, there is no valid console
            if (!ValidConsoleBuffer())
            {
                return;
            }

            if (!(input.Length == 1 || input.Length == 2))
            {
                // Should be 1 (flip) or two arguments (everything else)
                throw new ArgumentOutOfRangeException(nameof(input));
            }

            // Space each output entry by a line
            Console.WriteLine();

            // Show each input value
            foreach (var value in input)
            {
                Console.WriteLine(GetBinaryString(value) + " = " + value);
            }

            // Show divider
            var operationString = operation.ToString();

            Console.WriteLine(operationString + " " +
                              new string('-', Console.WindowWidth - (operationString.Length + 1)));

            // Show output
            Console.WriteLine(GetBinaryString(result) + " = " + result);
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            switch (Type)
            {
            case InputTypes.None:
                return(Type.ToString());

            case InputTypes.Keyboard:
                return(Key.ToString());

            case InputTypes.Mouse:
                return(MouseInput.ToString());

            case InputTypes.Controller:
                return(ControllerButton.ToString());

            default:
                break;
            }
            return(base.ToString());
        }
Ejemplo n.º 4
0
 public static InputTag OfType(InputTypes type, object value = null)
 {
     return(OfType(type.ToString().KabobCase().ToLowerInvariant(), value));
 }
Ejemplo n.º 5
0
        private DevComponents.AdvTree.Node AddNode(DevComponents.AdvTree.Node parentNode, string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue)
        {
            DevComponents.DotNetBar.SuperTooltipInfo tooltip = new DevComponents.DotNetBar.SuperTooltipInfo(name, null, description, null, null, DevComponents.DotNetBar.eTooltipColor.Gray);

            DevComponents.DotNetBar.Controls.CheckBoxX checkBoxSelect = new DevComponents.DotNetBar.Controls.CheckBoxX()
            {
                Checked          = selected,
                Style            = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled,
                BackColor        = Color.Transparent,
                CheckBoxPosition = DevComponents.DotNetBar.eCheckBoxPosition.Right
            };
            DevComponents.AdvTree.Node newNode = new DevComponents.AdvTree.Node()
            {
                HostedControl = checkBoxSelect,
                Name          = tag
            };
            DevComponents.AdvTree.Cell nameCell = new DevComponents.AdvTree.Cell()
            {
                Text = name
            };
            DevComponents.AdvTree.Cell valueCell = new DevComponents.AdvTree.Cell()
            {
                EditorType = DevComponents.AdvTree.eCellEditorType.Custom,
                Editable   = true
            };
            switch (inputType)
            {
            case InputTypes.Double:
                double?doubleValue = (double?)value;
                DevComponents.Editors.DoubleInput doubleInput = new DevComponents.Editors.DoubleInput()
                {
                    Value = doubleValue.HasValue ? doubleValue.Value : 0
                };
                valueCell.HostedControl   = doubleInput;
                doubleInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, doubleInput, setOptionValue); };
                break;

            case InputTypes.Integer:
                int?intValue = (int?)value;
                DevComponents.Editors.IntegerInput integerInput = new DevComponents.Editors.IntegerInput()
                {
                    Value = intValue.HasValue ? intValue.Value : 0
                };
                valueCell.HostedControl    = integerInput;
                integerInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, integerInput, setOptionValue); };
                break;

            case InputTypes.String:
                TextBox textBox = new TextBox()
                {
                    Text = (string)value
                };
                valueCell.HostedControl = textBox;
                textBox.TextChanged    += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, textBox, setOptionValue); };
                break;

            case InputTypes.Boolean:
                bool?boolValue = (bool?)value;

                DevComponents.DotNetBar.Controls.CheckBoxX checkBox = new DevComponents.DotNetBar.Controls.CheckBoxX()
                {
                    Checked   = boolValue.HasValue ? boolValue.Value : false,
                    Style     = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled,
                    BackColor = Color.Transparent,
                };
                checkBox.CheckedChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, checkBox, setOptionValue); };
                valueCell.HostedControl  = checkBox;
                break;

            default:
                throw new NotImplementedException("InputType not handled yet: " + inputType.ToString());
            }
            newNode.Cells.Add(nameCell);
            newNode.Cells.Add(valueCell);

            nameCell.Enabled  = checkBoxSelect.Checked;
            valueCell.Enabled = checkBoxSelect.Checked;
            valueCell.HostedControl.Enabled = checkBoxSelect.Checked;

            superTooltip1.SetSuperTooltip(newNode, tooltip);
            superTooltip1.SetSuperTooltip(checkBoxSelect, tooltip);
            superTooltip1.SetSuperTooltip(valueCell.HostedControl, tooltip);

            checkBoxSelect.CheckedChanged += delegate
            {
                nameCell.Enabled  = checkBoxSelect.Checked;
                valueCell.Enabled = checkBoxSelect.Checked;
                valueCell.HostedControl.Enabled = checkBoxSelect.Checked;

                if (checkBoxSelect.Checked)
                {
                    valueCell.HostedControl.Focus();
                }
            };
            if (parentNode == null)
            {
                advTree1.Nodes.Add(newNode);
            }
            else
            {
                parentNode.Nodes.Add(newNode);
            }

            return(newNode);
        }
        private DevComponents.AdvTree.Node AddNode(DevComponents.AdvTree.Node parentNode, string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue)
        {
            DevComponents.DotNetBar.SuperTooltipInfo tooltip = new DevComponents.DotNetBar.SuperTooltipInfo(name, null, description, null, null, DevComponents.DotNetBar.eTooltipColor.Gray);

            DevComponents.DotNetBar.Controls.CheckBoxX checkBoxSelect = new DevComponents.DotNetBar.Controls.CheckBoxX()
            {
                Checked = selected,
                Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled,
                BackColor = Color.Transparent,
                CheckBoxPosition = DevComponents.DotNetBar.eCheckBoxPosition.Right
            };
            DevComponents.AdvTree.Node newNode = new DevComponents.AdvTree.Node()
            {
                HostedControl = checkBoxSelect,
                Name = tag
            };
            DevComponents.AdvTree.Cell nameCell = new DevComponents.AdvTree.Cell()
            {
                Text = name
            };
            DevComponents.AdvTree.Cell valueCell = new DevComponents.AdvTree.Cell()
            {
                EditorType = DevComponents.AdvTree.eCellEditorType.Custom,
                Editable = true
            };
            switch (inputType)
            {
                case InputTypes.Double:
                    double? doubleValue = (double?)value;
                    DevComponents.Editors.DoubleInput doubleInput = new DevComponents.Editors.DoubleInput()
                    {
                        Value = doubleValue.HasValue ? doubleValue.Value : 0
                    };
                    valueCell.HostedControl = doubleInput;
                    doubleInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, doubleInput, setOptionValue); };
                    break;
                case InputTypes.Integer:
                    int? intValue = (int?)value;
                    DevComponents.Editors.IntegerInput integerInput = new DevComponents.Editors.IntegerInput()
                    {
                        Value = intValue.HasValue ? intValue.Value : 0
                    };
                    valueCell.HostedControl = integerInput;
                    integerInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, integerInput, setOptionValue); };
                    break;
                case InputTypes.String:
                    TextBox textBox = new TextBox()
                    {
                        Text = (string)value
                    };
                    valueCell.HostedControl = textBox;
                    textBox.TextChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, textBox, setOptionValue); };
                    break;
                case InputTypes.Boolean:
                    bool? boolValue = (bool?)value;

                    DevComponents.DotNetBar.Controls.CheckBoxX checkBox = new DevComponents.DotNetBar.Controls.CheckBoxX()
                    {
                        Checked = boolValue.HasValue ? boolValue.Value : false,
                        Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled,
                        BackColor = Color.Transparent,
                    };
                    checkBox.CheckedChanged += delegate (object sender, EventArgs e) { ValueChanged(checkBoxSelect, checkBox, setOptionValue); };
                    valueCell.HostedControl = checkBox;
                    break;
                default:
                    throw new NotImplementedException("InputType not handled yet: " + inputType.ToString());
            }
            newNode.Cells.Add(nameCell);
            newNode.Cells.Add(valueCell);

            nameCell.Enabled = checkBoxSelect.Checked;
            valueCell.Enabled = checkBoxSelect.Checked;
            valueCell.HostedControl.Enabled = checkBoxSelect.Checked;

            superTooltip1.SetSuperTooltip(newNode, tooltip);
            superTooltip1.SetSuperTooltip(checkBoxSelect, tooltip);
            superTooltip1.SetSuperTooltip(valueCell.HostedControl, tooltip);

            checkBoxSelect.CheckedChanged += delegate
            {
                nameCell.Enabled = checkBoxSelect.Checked;
                valueCell.Enabled = checkBoxSelect.Checked;
                valueCell.HostedControl.Enabled = checkBoxSelect.Checked;

                if (checkBoxSelect.Checked)
                    valueCell.HostedControl.Focus();
            };
            if (parentNode == null)
                advTree1.Nodes.Add(newNode);
            else
                parentNode.Nodes.Add(newNode);

            return newNode;
        }