using AddInPlugin.Util;
|
using DynamicExpresso;
|
using OpenTap;
|
using OpenTap.Addin.Annotation;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Xml.Serialization;
|
|
namespace AddInPlugin
|
{
|
[Display("ElseIf", Group:"流程控制", Order: 0)]
|
[AllowAnyChild]
|
public class ElseIfConditionStep : ConditionBase
|
{
|
public ElseIfConditionStep() : base()
|
{
|
Rules.Add(() => this.GetPreviousStep() is ConditionBase, "必须在条件之后", "");
|
}
|
|
public override void PrePlanRun()
|
{
|
|
}
|
|
public override void Run()
|
{
|
try
|
{
|
var previous = this.GetPreviousStep();
|
if (!(previous is ConditionBase cb))
|
{
|
throw new Exception("Error Stucture");
|
}
|
if (cb.ConditionResult != true && Condition != null)
|
{
|
ConditionResult = (bool)PlanRun.Resolve(this, Condition);
|
|
if (ConditionResult == true)
|
{
|
RunChildSteps();
|
UpgradeVerdict(Verdict.Pass);
|
}
|
else
|
{
|
UpgradeVerdict(Verdict.NotSet);
|
}
|
}
|
else
|
{
|
UpgradeVerdict(Verdict.NotSet);
|
}
|
}
|
catch (Exception ex)
|
{
|
Log.Error("ElseIf Run error. {0}", ex);
|
ConditionResult = null;
|
UpgradeVerdict(Verdict.Error);
|
}
|
}
|
|
public override void PostPlanRun()
|
{
|
}
|
}
|
}
|