/// <summary> /// Constructor /// </summary> /// <param name="nFunctionKeyID"></param> /// <param name="strKeyLabel"></param> /// <param name="nHandlerID"></param> /// <param name="nSubmenuID"></param> /// <param name="eType"></param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // Created // public FunctionKeyAssignment(int nFunctionKeyID, String strKeyLabel, int nHandlerID, int nSubmenuID, FunctionKeyType eType) { FunctionKey = nFunctionKeyID; KeyLabel = strKeyLabel; HandlerID = nHandlerID; SubmenuID = nSubmenuID; Type = eType; }
/// <summary> /// Reads function type /// </summary> /// <param name="childNode"></param> /// <returns></returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // Created // private FunctionKeyType ReadType(XmlNode childNode) { FunctionKeyType eType = FunctionKeyType.CONFIRM; String strType = GetAttribute(childNode, TYPE); if (strType.Length > 0) { eType = (FunctionKeyType)Int16.Parse(strType, CultureInfo.InvariantCulture); } return eType; }
/// <summary> /// This method is used to read the complete definition of a submeny from /// the UI Definition file. Note that the starting menuID will always be defined /// as 1. /// </summary> /// <param name="nMenuID">The ID of the menu to read.</param> /// <param name="strMenuTitle">The title of the menu.</param> /// <param name="KeyAssignments">The assignments for keys in the menu.</param> /// <param name="nDefaultKey">The default key that should be pressed when keys are loaded.</param> /// <returns>Whether or not the menu was read.</returns> public Boolean ReadMenu(int nMenuID, out String strMenuTitle, out List<FunctionKeyAssignment> KeyAssignments, out int nDefaultKey) { Boolean boolMenuFound = false; strMenuTitle = ""; nDefaultKey = 0; if (IsMenuSpecial(nMenuID)) { boolMenuFound = ReadSpecialMenu(nMenuID, out strMenuTitle, out KeyAssignments, out nDefaultKey); } else { KeyAssignments = new List<FunctionKeyAssignment>(); // Search through all the submenu nodes until we find // the menu we are looking for by comparing the menu IDs foreach (XmlNode menuNode in m_xmlMenuNodeList) { String strMenuID = GetAttribute(menuNode, MENU_ID); if (strMenuID == nMenuID.ToString(CultureInfo.InvariantCulture)) { boolMenuFound = true; // Extract the menu title strMenuTitle = GetAttribute(menuNode, MENU_TITLE); // Next extract the key handler definitions XmlNodeList xmlMenuItemNodeList = menuNode.ChildNodes; foreach (XmlNode childNode in xmlMenuItemNodeList) { if (childNode.Name == KEY_HANDLER) { int nKeyID = Int16.Parse(GetAttribute(childNode, FUNCTION_KEY), CultureInfo.InvariantCulture); String strKeyLabel = GetAttribute(childNode, KEY_TEXT); int nHandlerID = ReadHandlerID(childNode); int nSubmenuID = ReadSubMenuID(childNode); FunctionKeyType eType = ReadType(childNode); KeyAssignments.Add(new FunctionKeyAssignment(nKeyID, strKeyLabel, nHandlerID, nSubmenuID, eType)); } else if (childNode.Name == DEFAULT_KEY) { nDefaultKey = Int16.Parse(childNode.InnerText, CultureInfo.InvariantCulture); } } break; } } } return boolMenuFound; }