using AddInPlugin.Util;
|
using OpenTap;
|
using System;
|
|
namespace AddInPlugin
|
{
|
public class PostUIMsgHandler
|
{
|
public static event EventHandler<PostUIMsg> OnPostUIMsg;
|
|
public static void OnPostUIMsgGet(PostUIMsg msg)
|
{
|
OnPostUIMsg?.Invoke(null, msg);
|
}
|
}
|
|
public class PostUIMsg
|
{
|
public int EventCode;
|
public string StringData;
|
public bool BoolData;
|
public double NumberData;
|
}
|
|
[Display("PostUIMsgStep", Description: "UIÏûÏ¢")]
|
public class PostUIMsgStep : TestStep
|
{
|
[Display("ʼþ")]
|
public int EventCode { get; set; }
|
[Display("×Ö·û")]
|
public string StringData { get; set; }
|
[Display("²¼¶û")]
|
public bool BoolData { get; set; }
|
[Display("Êý×Ö")]
|
public double NumberData { get; set; }
|
|
|
public PostUIMsgStep()
|
{
|
// ToDo: Set default values for properties / settings.
|
}
|
|
public override void PrePlanRun()
|
{
|
|
}
|
|
public override void Run()
|
{
|
try
|
{
|
PostUIMsg msg = new PostUIMsg
|
{
|
EventCode = this.EventCode,
|
StringData = string.IsNullOrEmpty(StringData) ? StringData : PlanRun.Resolve(this, StringData, typeof(string)),
|
BoolData = this.BoolData,
|
NumberData = this.NumberData,
|
};
|
PostUIMsgHandler.OnPostUIMsgGet(msg);
|
this.Verdict = Verdict.NotSet;
|
}
|
catch (Exception ex)
|
{
|
Log.Error("PostUIMsgStep Run Error. {0}", ex);
|
this.Verdict = Verdict.Error;
|
}
|
}
|
|
public override void PostPlanRun()
|
{
|
|
}
|
}
|
}
|