/// <summary>
        ///     Apply the command label.
        /// </summary>
        /// <param name="ergodoxKey">The <see cref="ErgodoxKey" /> containing the command to be applied.</param>
        /// <param name="key">The <see cref="EZKey" /> to apply the command to.</param>
        /// <returns><c>True</c> if command has been applied.</returns>
        private bool AddCommandLabel(ErgodoxKey ergodoxKey, EZKey key)
        {
            if (IsCommandEmpty(ergodoxKey.Command))
            {
                return(false);
            }

            var commandDefinition = GetKeyDefinition(ergodoxKey.Command);

            key.Modifier = key.Label;
            key.Label    = new KeyLabel(commandDefinition.Label, commandDefinition.IsGlyph);

            return(true);
        }
        private void ProcessModifiers(ErgodoxKey ergodoxKey, EZKey key)
        {
            if (ergodoxKey.Modifiers == null)
            {
                return;
            }

            var mods = GetModifiersApplied(ergodoxKey.Modifiers);

            if (!mods.Any())
            {
                return;
            }

            key.Modifier    = new KeyLabel(AggregateModifierLabels(mods));
            key.DisplayType = KeyDisplayType.ModifierOnTop;
        }
        private EZKey PrepareKeyLabels(ErgodoxKey ergodoxKey, string layerColor)
        {
            Logger.TraceMethod();
            Logger.DebugInputParam(nameof(ergodoxKey), ergodoxKey);

            var keyDefinition = GetKeyDefinition(ergodoxKey.Code);

            /** Every category has a label, so no need to make a special case :
             *
             * KeyCategory.Autoshift
             * KeyCategory.Digit
             * KeyCategory.Letters
             * KeyCategory.Fn
             * KeyCategory.Fw
             * KeyCategory.Lang
             * KeyCategory.Numpad
             * KeyCategory.Other
             * KeyCategory.Punct
             * KeyCategory.ShiftedPunct
             * KeyCategory.System
             *
             **/
            var key = new EZKey
            {
                KeyCategory = keyDefinition.KeyCategory,
                Label       = new KeyLabel(ergodoxKey.CustomLabel != null ? ergodoxKey.CustomLabel : keyDefinition.Label, keyDefinition.IsGlyph),
                Color       = GetColor(ergodoxKey.GlowColor, layerColor),
                DisplayType = KeyDisplayType.SimpleLabel
            };

            switch (keyDefinition.KeyCategory)
            {
            case KeyCategory.DualFunction:

                if (AddCommandLabel(ergodoxKey, key))
                {
                    key.DisplayType = KeyDisplayType.ModifierUnder;
                }
                else
                {
                    key.KeyCategory = KeyCategory.Modifier;
                }

                break;

            case KeyCategory.Layer:
            case KeyCategory.LayerShortcuts:
                key.Label.Content = string.Format(key.Label.Content, ergodoxKey.Layer.ToString());

                if (AddCommandLabel(ergodoxKey, key))
                {
                    key.DisplayType = KeyDisplayType.ModifierUnder;
                }

                break;

            case KeyCategory.Modifier:

                if (ergodoxKey.Code == KeyCodeOsm && !IsCommandEmpty(ergodoxKey.Command))
                {
                    var commandDefinition = GetKeyDefinition(ergodoxKey.Command);
                    key.Modifier    = new KeyLabel(commandDefinition.Label);
                    key.DisplayType = KeyDisplayType.ModifierOnTop;
                }

                break;

            case KeyCategory.Media:
            case KeyCategory.Mouse:
            case KeyCategory.Nav:
            case KeyCategory.Spacing:
            case KeyCategory.Shine:
                key.DisplayType = KeyDisplayType.SimpleLabel;

                break;

            case KeyCategory.Shortcuts:

                if (!IsCommandEmpty(ergodoxKey.Command))
                {
                    var commandDefinition = GetKeyDefinition(ergodoxKey.Command);
                    key.Label.Content = $"{key.Label.Content} + {commandDefinition.Label}";
                }

                break;

            case KeyCategory.French:
                key.InternationalHint = "fr";

                break;

            case KeyCategory.German:
                key.InternationalHint = "de";

                break;

            case KeyCategory.Hungarian:
                key.InternationalHint = "hu";

                break;

            case KeyCategory.Spanish:
                key.InternationalHint = "es";

                break;

            case KeyCategory.Nordic:
                key.InternationalHint = "no";

                break;
            }

            ProcessModifiers(ergodoxKey, key);

            Logger.DebugOutputParam(nameof(key), key);

            return(key);
        }