using OpenTap.Addin.Util; using OpenTap; using System; using OpenTap.Addin.Entity; using OpenTap.Addin.Listener; namespace AddInPlugin { [Display("PostUIMsgStep", Description: "UIÏûÏ¢")] public class PostUIMsgStep : TestStep { [Display("ʼþ")] public int EventCode { get; set; } [Display("×Ö·û´®")] public string StringData { get; set; } [Display("²¼¶û")] public string BoolData { get; set; } [Display("Êý×Ö")] public string NumberData { get; set; } public PostUIMsgStep() { // ToDo: Set default values for properties / settings. } public override void PrePlanRun() { } protected override void RunDetail() { try { PostUIMsg msg = new PostUIMsg { EventCode = this.EventCode, StringData = string.IsNullOrEmpty(StringData) ? StringData : PlanRun.Resolve(this, StringData, typeof(string)), BoolData = string.IsNullOrEmpty(BoolData) ? false : PlanRun.Resolve(this, BoolData, typeof(bool)), NumberData = string.IsNullOrEmpty(NumberData) ?new NumberData(0) : PlanRun.Resolve(this, NumberData, typeof(NumberData)), }; PlanRun.uIMessageHandler.OnPostUIMsgGet(msg); this.Verdict = Verdict.NotSet; } catch (Exception ex) { Log.Error("PostUIMsgStep Run Error. {0}", ex); this.Verdict = Verdict.Error; } } public override void PostPlanRun() { } } }