Ejemplo n.º 1
0
        public async Task PopulateNodeGrid(ObjectId taskID)
        {
            string taskBaseURL = (await Context.GetTask(taskID, null)).BaseUrl;
            List <CommandViewModel> commands = (await Context.GetTaskCommands(taskID)).OrderBy(m => m.Order).ToList();
            MainWindow window = (MainWindow)Application.Current.MainWindow;

            window.pnlCommandViewer.Children.Clear();
            window.pnlCommandViewer.Children.Add(new StartNode());
            CommandCreator beginningCreator = new CommandCreator(0, taskBaseURL, taskID);

            beginningCreator.Click += btnCommandCreator_Click;
            window.pnlCommandViewer.Children.Add(beginningCreator);
            for (int i = 0; i < commands.Count; i++)
            {
                switch (commands[i].Type)
                {
                case CommandType.Click:
                    ClickCommand clickCommand = new ClickCommand(commands[i].ID, commands[i].TaskID, commands[i].TaskBaseURL, commands[i].Order, "btn" + commands[i].Name, commands[i].Enabled, commands[i].Name,
                                                                 commands[i].TaskBaseURL, commands[i].Selector, commands[i].WaitSelector, commands[i].WaitForSeconds);
                    clickCommand.Click += btnCommandCreator_Click;
                    window.pnlCommandViewer.Children.Add(clickCommand);
                    break;

                case CommandType.Type:
                    TypeCommand typeCommand = new TypeCommand(commands[i].ID, commands[i].TaskID, commands[i].TaskBaseURL, commands[i].Order, "btn" + commands[i].Name, commands[i].Enabled, commands[i].Name,
                                                              commands[i].TaskBaseURL, commands[i].Selector, commands[i].WaitSelector, commands[i].WaitForSeconds, commands[i].SendKeysText);
                    typeCommand.Click += btnCommandCreator_Click;
                    window.pnlCommandViewer.Children.Add(typeCommand);
                    break;

                case CommandType.Save:
                    SaveCommand saveCommand = new SaveCommand(commands[i].ID, commands[i].TaskID, commands[i].TaskBaseURL, commands[i].Order, "btn" + commands[i].Name, commands[i].Enabled, commands[i].Name,
                                                              commands[i].TaskBaseURL, commands[i].Selector, commands[i].WaitSelector, commands[i].WaitForSeconds, commands[i].AttributeValue, commands[i].Collection);
                    saveCommand.Click += btnCommandCreator_Click;
                    window.pnlCommandViewer.Children.Add(saveCommand);
                    break;
                }

                CommandCreator endingCreator = new CommandCreator(i + 1, taskBaseURL, taskID);
                endingCreator.Click += btnCommandCreator_Click;
                window.pnlCommandViewer.Children.Add(endingCreator);
            }

            window.pnlCommandViewer.Children.Add(new EndNode());
        }
Ejemplo n.º 2
0
 public CommandCreate(CommandCreator creator)
     : this()
 {
     CommandURL = creator.CommandURL;
     Command    = new Command(ObjectId.Empty, creator.TaskID, "", creator.Order, CommandType.Click, true, "", "", 0);
 }
Ejemplo n.º 3
0
        public void ShowCommandCreate(CommandCreator creator)
        {
            CommandCreate commandCreateWindow = new CommandCreate(creator);

            commandCreateWindow.Show();
        }