Example #1
0
        ///<summary>
        ///Looks up a next view based on current command id and and current view id.
        ///</summary>
        ///<param name="commandID">The id of the current command.</param>
        ///<param name="viewID">The id of the current view.</param>
        ///<returns>The next web view to go.</returns>
        public virtual string GetNextView(string viewID, string commandID)
        {
            string nextView = string.Empty;

            if (_globalCommands.ContainsKey(commandID))
            {
                nextView = _globalCommands[commandID];
            }
            else
            {
                CommandsSetting setting = null;
                if (_mappings.Contains(viewID))
                {
                    setting = _mappings[viewID] as CommandsSetting;
                }
                else
                {
                    throw new ConfigurationException(Resource.ResourceManager.FormatMessage(Resource.MessageKeys.CantFindCommandMapping, viewID));
                }
                nextView = setting[commandID];
                if (nextView == null)
                {
                    throw new ConfigurationException(Resource.ResourceManager.FormatMessage(Resource.MessageKeys.CantGetNextView, viewID, commandID));
                }
            }

            return(nextView);
        }
Example #2
0
 /// <summary>
 /// Load the command mapping
 /// </summary>
 /// <param name="configNode">The XmlNode from the configuration file.</param>
 private void LoadCommandMapping(XmlNode configNode)
 {
     foreach (XmlNode currentNode in configNode.SelectNodes(NODE_COMMANDS_XPATH))
     {
         CommandsSetting setting = new CommandsSetting(currentNode);
         _mappings.Add(setting.View, setting);
     }
 }