using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Xml.Serialization;
namespace OpenTap.Plugins.BasicSteps
{
/// An element representing a row in a sweep loop. This has a bunch of dynamically added elements.
public class SweepRow
{
/// Gets or sets if the row is enabled.
[Display("Enabled", "Marks if this row should be included during the sweep.")]
public bool Enabled { get; set; } = true;
/// The sweep step owning this row. This is needed to figure out which properties the object has.
[Browsable(false), XmlIgnore]
public SweepParameterStep Loop { get; set; }
/// Dictionary for storing dynamic property values.
public Dictionary Values = new Dictionary();
internal string GetIterationString() => string
.Join(", ",
Values.OrderBy(x => x.Key).Select(x => $"{x.Key} = {x.Value}"));
/// Create a sweep row instance.
public SweepRow()
{
}
/// Create a sweep row instance with a step.
public SweepRow(SweepParameterStep loop)
{
this.Loop = loop;
}
}
}