public async Task PopulateActionsGrid(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.pnlCommandRunner.Children.Clear(); window.pnlCommandRunner.Children.Add(new StartNode()); 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); window.pnlCommandRunner.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); window.pnlCommandRunner.Children.Add(typeCommand); break; } } window.pnlCommandRunner.Children.Add(new EndNode()); }
public CommandCreate(TypeCommand creator) : this() { CommandURL = creator.TaskBaseURL; Command = new Command(creator.ID, creator.TaskID, creator.Name, creator.Order, CommandType.Click, creator.Enabled, creator.Selector, creator.WaitSelector, creator.WaitForSeconds); this.lblCommandCreate.Content = "Command Update"; this.txtName.Text = Command.Name; this.cboType.SelectedIndex = (int)Command.Type; this.chkEnabled.IsChecked = Command.Enabled; this.txtSelector.Text = Command.Selector; this.txtWaitSelector.Text = Command.WaitSelector; this.txtWaitFor.Text = Command.WaitForSeconds.ToString(); this.txtSendKeysText.Text = Command.SendKeysText; }
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()); }
public void ShowTypeCommandUpdate(TypeCommand command) { CommandCreate commandCreateWindow = new CommandCreate(command); commandCreateWindow.Show(); }