/// <summary> /// get an UIA action for the line /// </summary> /// <param name="actLine">the action line</param> /// <returns>the UIA action</returns> public override Action getAction(ActionLine actLine) { Window targetWindow = null; IUIItem targetControl = null; if (!Actions.ContainsKey(actLine.ActionName)) { throw new Exception(Constants.Messages.Error_Executing_NoAction); } if (actLine.WindowName != null && !Parent.Interfaces.ContainsKey(actLine.WindowName)) { throw new Exception(Constants.Messages.Error_Matching_Window_NoDefinition); } //if (actLine.WindowName != null ) // throw new Exception(Constants.Messages.Error_Matching_Window_NoDefinition); // search for the target control //Dictionary<string, string> Key = Parent.Interfaces.Values; if (actLine.WindowName != null) { targetWindow = FindWindow(Parent.Interfaces[actLine.WindowName].Properties); } if (actLine.ControlName != null) { targetControl = FindControl(targetWindow, Parent.Interfaces[actLine.WindowName].Controls[actLine.ControlName]); } // prepare the action UIAAction action = Actions[actLine.ActionName] as UIAAction; action.Window = targetWindow; action.Control = targetControl; action.Params = actLine.Arguments; return(action); }
/// <summary> /// create an action for the line /// </summary> /// <param name="actLine">the action line</param> /// <returns>the action</returns> public override IAction getAction(ActionLine actLine) { Window targetWindow = null; IUIItem targetControl = null; if (!Actions.ContainsKey(actLine.ActionName)) { return(null); } if (actLine.WindowName != null && !Parent.Interfaces.ContainsKey(actLine.WindowName)) { throw new Exception(Constants.Messages.Error_Matching_Window_NoDefinition); } // search for the target control if (actLine.WindowName != null) { targetWindow = FindWindow(Parent.Interfaces[actLine.WindowName].Properties); if (targetWindow != null && actLine.ControlName != null) { if (!Parent.Interfaces[actLine.WindowName].Controls.ContainsKey(actLine.ControlName)) { throw new Exception(Constants.Messages.Error_Matching_Control_NoDefinition); } targetControl = FindControl(targetWindow, Parent.Interfaces[actLine.WindowName].Controls[actLine.ControlName]); } } // prepare the action UIAAction action = Actions[actLine.ActionName] as UIAAction; action.Window = targetWindow; action.Control = targetControl; action.Params = actLine.Arguments; return(action); }