Пример #1
0
 public static void GetArguments(this AutomationActionNode actionNode)
 {
     foreach (string argKey in actionNode.Action.Arguments)
     {
         Console.Write("  " + argKey + ": ");
         string argVal = Console.ReadLine();
         actionNode.Arguments[argKey] = argVal;
     }
 }
Пример #2
0
 public static void BuildTree(AutomationTree tree, Stack <string> windowStack, int depth = 0)
 {
     if (tree.CurrentNode is AutomationWindowNode)
     {
         AutomationWindowNode windowNode = tree.CurrentNode as AutomationWindowNode;
         AutomationWindow     window     = windowNode.Window;
         windowStack.Push(windowNode.Window.Name);
         depth++;
         while (!windowNode.Terminated)
         {
             Console.WriteLine(string.Format("\nDepth: {0}", string.Join(" -> ", windowStack.Reverse())));
             window.PrintActions(windowNode.Terminatable);
             //List<AutomationWindow> previousWindows = FindPrevious(window);
             int index = GetChoice(windowNode.Terminatable);
             if (index == -1)
             {
                 windowNode.Terminated = true;
                 return;
             }
             AutomationAction action = Actions[window.Actions[index], window.Name];
             action.Compile = true;
             AutomationActionNode actionNode = new AutomationActionNode(action, windowNode)
             {
                 Depth = depth
             };
             actionNode.GetArguments();
             windowNode.Add(actionNode);
             windowNode.Terminated = action.Terminating;
             tree.CurrentNode      = actionNode;
             BuildTree(tree, windowStack, depth);
         }
         depth--;
         windowStack.Pop();
     }
     else if (tree.CurrentNode is AutomationActionNode)
     {
         AutomationActionNode actionNode       = tree.CurrentNode as AutomationActionNode;
         AutomationWindowNode parentWindowNode = actionNode.Parent as AutomationWindowNode;
         AutomationAction     action           = actionNode.Action;
         depth++;
         foreach (string windowName in action.Windows)
         {
             AutomationWindow     window     = Windows[windowName];
             AutomationWindowNode windowNode = new AutomationWindowNode(window, actionNode)
             {
                 Depth = depth
             };
             actionNode.Add(windowNode);
             tree.CurrentNode = windowNode;
             BuildTree(tree, windowStack, depth);
         }
         depth--;
     }
 }
Пример #3
0
 public AutomationWindowNode(AutomationWindow window, AutomationActionNode parent)
 {
     Window  = window;
     Parent  = parent;
     Actions = new List <AutomationActionNode>();
 }