protected static KeyActionMapping LoadWorkflowActionShortcut(XPathNavigator shortcutNav) { string key = null; string workflowAction = null; XPathNavigator attrNav = shortcutNav.Clone(); if (attrNav.MoveToFirstAttribute()) { do { switch (attrNav.Name) { case "Key": key = attrNav.Value; break; case "WorkflowAction": workflowAction = attrNav.Value; break; default: throw new ArgumentException("'" + shortcutNav.Name + "' element doesn't support an attribute '" + attrNav.Name + "'"); } } while (attrNav.MoveToNextAttribute()); } if (string.IsNullOrEmpty(key)) { throw new ArgumentException(string.Format("{0}: 'Key' attribute is missing", shortcutNav.Name)); } if (string.IsNullOrEmpty(workflowAction)) { throw new ArgumentException(string.Format("{0}: 'WorkflowAction' attribute missing", shortcutNav.Name)); } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); WorkflowAction action; // We can only create shortcuts for MenuActions that have been defined before if (!workflowManager.MenuStateActions.TryGetValue(new Guid(workflowAction), out action)) { throw new ArgumentException(string.Format("{0} WorkflowAction with ID {1} does not exists, skipping shortcut!", shortcutNav.Name, workflowAction)); } KeyActionMapping mapping = new KeyActionMapping(); mapping.Keys.AddRange(ParseKeys(key)); mapping.Action = action; return(mapping); }
protected static KeyActionMapping LoadWorkflowActionShortcut(XPathNavigator shortcutNav) { string key = null; string workflowAction = null; XPathNavigator attrNav = shortcutNav.Clone(); if (attrNav.MoveToFirstAttribute()) do { switch (attrNav.Name) { case "Key": key = attrNav.Value; break; case "WorkflowAction": workflowAction = attrNav.Value; break; default: throw new ArgumentException("'" + shortcutNav.Name + "' element doesn't support an attribute '" + attrNav.Name + "'"); } } while (attrNav.MoveToNextAttribute()); if (string.IsNullOrEmpty(key)) throw new ArgumentException(string.Format("{0}: 'Key' attribute is missing", shortcutNav.Name)); if (string.IsNullOrEmpty(workflowAction)) throw new ArgumentException(string.Format("{0}: 'WorkflowAction' attribute missing", shortcutNav.Name)); IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>(); WorkflowAction action; // We can only create shortcuts for MenuActions that have been defined before if (!workflowManager.MenuStateActions.TryGetValue(new Guid(workflowAction), out action)) throw new ArgumentException(string.Format("{0} WorkflowAction with ID {1} does not exists, skipping shortcut!", shortcutNav.Name, workflowAction)); KeyActionMapping mapping = new KeyActionMapping(); mapping.Keys.AddRange(ParseKeys(key)); mapping.Action = action; return mapping; }