private void Save() { var selFindByUC = selectElementuc1.GetData(); if (parentForm != null) { if (command == null || command.OrderIndex == 0) { command = new ClickButtonCommand(); 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.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(); }
public ClickButtonCommandUC(ICommand command, Test test, EditTest parentForm, EditCommand mainCommandForm, IProjectManager projectManager) { InitializeComponent(); this.command = command as ClickButtonCommand; this.test = test; this.parentForm = parentForm; this.mainCommandForm = mainCommandForm; this.projectManager = projectManager; }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JObject jo = JObject.Load(reader); string type = (string)jo["_type"]; if (type == typeof(Project).Name) { Project item = new Project(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(Test).Name) { Test item = new Test(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(NavigateToUrlCommand).Name) { Command item = new NavigateToUrlCommand(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(TakeScreenshotCommand).Name) { Command item = new TakeScreenshotCommand(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(IfContainsStringCommand).Name) { Command item = new IfContainsStringCommand(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(FillTextboxCommand).Name) { Command item = new FillTextboxCommand(); serializer.Populate(jo.CreateReader(), item); return(item); } else if (type == typeof(ClickButtonCommand).Name) { Command item = new ClickButtonCommand(); serializer.Populate(jo.CreateReader(), item); return(item); } return(null); }