Exemplo n.º 1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="elementName"></param>
            /// <param name="elementValue"></param>
            /// <param name="attributes"></param>
            public void endElement(String elementName, String elementValue, NameValueCollection attributes)
            {
                if (elementName == ConstInterface.MG_TAG_KBDITM)
                {
                    List <KeyboardItem> kbdItemArray = null;
                    Int32     arrayKey;
                    int       actionId = 0;
                    int       keyCode  = 0;
                    Modifiers modifier = Modifiers.MODIFIER_NONE;
                    int       states   = 0;

                    IEnumerator enumerator = attributes.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        String attr = (String)enumerator.Current;
                        switch (attr)
                        {
                        case ConstInterface.MG_ATTR_ACTIONID:
                            actionId = Int32.Parse(attributes[attr]);
                            break;

                        case ConstInterface.MG_ATTR_KEYCODE:
                            keyCode = Int32.Parse(attributes[attr]);
                            break;

                        case ConstInterface.MG_ATTR_MODIFIER:
                            //modifier = (Modifiers)valueStr[0];
                            modifier = (Modifiers)(attributes[attr])[0];
                            break;

                        case ConstInterface.MG_ATTR_STATES:
                            states = Int32.Parse(attributes[attr]);
                            break;

                        default:
                            Logger.Instance.WriteExceptionToLog(
                                "There is no such tag in KeyboardItem class. Insert case to KeyboardItem.initElements() for: " +
                                attr);
                            break;
                        }
                    }
                    KeyboardItem kbdItm = new KeyboardItem(actionId, keyCode, modifier, states);
                    arrayKey     = _enclosingInstance.getKeyboardItemHashCode(kbdItm.getKeyCode(), kbdItm.getModifier());
                    kbdItemArray = (List <KeyboardItem>)_enclosingInstance._kbdMap[arrayKey];
                    if (kbdItemArray == null)
                    {
                        kbdItemArray = new List <KeyboardItem>();
                        _enclosingInstance._kbdMap[arrayKey] = kbdItemArray;
                    }
                    kbdItemArray.Add(kbdItm);
                }
                // It should come in this function only for KbdMap tag or for Kbditm tag..For other tags we should write error to log
                else if (elementName != ConstInterface.MG_TAG_KBDMAP)
                {
                    Logger.Instance.WriteExceptionToLog("There is no such tag in FontTable.endElement(): " + elementName);
                }
            }
Exemplo n.º 2
0
        /// <summary>
        ///   This method returns the list of menu entries with access key
        /// </summary>
        public List <MenuEntry> getMenuEntriesWithAccessKey(KeyboardItem kbdItem)
        {
            String key = "" + kbdItem.getKeyCode() + kbdItem.getModifier();

            return((List <MenuEntry>)_menuEntriesWithAccessKey[key]);
        }