public SelectFromDropdownCommandUC(ICommand command, Test test, EditTest parentForm, EditCommand mainCommandForm, IProjectManager projectManager) { InitializeComponent(); this.command = command as SelectFromDropdownCommand; this.test = test; this.parentForm = parentForm; this.mainCommandForm = mainCommandForm; this.projectManager = projectManager; }
private void Save() { var selFindByUC = selectElementuc1.GetData(); if (parentForm != null) { if (command == null || command.OrderIndex == 0) { command = new SelectFromDropdownCommand(); command.OrderIndex = 1; if (test.Commands.Any()) { command.OrderIndex = test.Commands.Max(i => i.OrderIndex) + 1; } test.Commands.Add(command); } command.Title = mainCommandForm.GetTitle(); command.SelectByTextValue = cmbByTextValue.Text; command.SelectedValue = txtSelectedValue.Text; command.FindBy = selFindByUC.FindBy; command.FindByValue = selFindByUC.FindByValue; command.Wait = selFindByUC.Wait; command.ScrollToElement = selFindByUC.ScrollToElement; Guid?belongToIndex = comboBox1.SelectedValue as Guid?; if (belongToIndex.HasValue) { command.BelongsToCommandIndex = belongToIndex; } else { command.BelongsToCommandIndex = null; } } projectManager.SaveProject(); }