示例#1
0
        protected void AddKey(GuiKeyboard heatmapKeys, StackPanel row, Button button, params string[] keyCodes)
        {
            foreach (var keyCode in keyCodes)
            {
                heatmapKeys.Add(keyCode, button);
            }

            row.Children.Add(button);
        }
 public KeyPressController(
     Func <bool> isWindowMinimized,
     Action <string> updateCurrentKey,
     Action <string> updateKeyPopularity,
     Action <double> updateProductiveRatio,
     Action <double> updateDestructiveRatio,
     Action <double> updateNaviationRatio,
     Action <double> updateMetaRatio,
     KeysCounter counter,
     GuiKeyboard keyboard)
 {
     this.isWindowMinimized      = isWindowMinimized;
     this.updateCurrentKey       = updateCurrentKey;
     this.updateKeyPopularity    = updateKeyPopularity;
     this.updateProductiveRatio  = updateProductiveRatio;
     this.updateDestructiveRatio = updateDestructiveRatio;
     this.updateNaviationRatio   = updateNaviationRatio;
     this.updateMetaRatio        = updateMetaRatio;
     this.counter  = counter;
     this.keyboard = keyboard;
 }
示例#3
0
        public override Tuple <StackPanel, GuiKeyboard> CreateWpfKeys()
        {
            var heatmap = new GuiKeyboard();

            var keyboard = new StackPanel()
            {
                Orientation = Orientation.Vertical
            };

            foreach (var configRow in config.Rows)
            {
                var uiRow = CreateRow(keyboard);
                if (configRow.IsVertialSpacer)
                {
                    AddSpacer(uiRow, 0, configRow.Height * NormalHeight);
                    continue;
                }

                foreach (var key in configRow.Keys)
                {
                    if (key.HorizontalSpace)
                    {
                        AddSpacer(uiRow, key.Width * NormalWidth, 0);
                    }
                    else
                    {
                        var button = CreateButton(key.Width * NormalWidth, NormalHeight, key.Label1, key.Label2, key.Label3, key.Label4);

                        var keyCodes = KeyboardConstants.CombineKeysWithStandardModifiers(new [] { key.KeyCode }).ToArray();
                        AddKey(heatmap, uiRow, button, keyCodes);
                    }
                }
            }

            return(Tuple.Create(keyboard, heatmap));
        }
 public void ChangeKeyboard(GuiKeyboard newKeyboard)
 {
     keyboard = newKeyboard;
 }