using System; //using AddInPlugin; //using AddInPlugin.Util; //using Microsoft.Win32; //using OpenTap; //using OpenTap.Addin; //using OpenTap.Addin.Util; //using System.ComponentModel; //using System.IO; namespace Plugin.TsSupport { public class TapWrapper : ITestExecutionWrapper { public event EventHandler UIMessageEvent; public event EventHandler EndExecutionEvent; public void CommitToDisk(bool option) { } public T GetFileGlobalValue(string key, int option) { return default(T); } public T GetStationGlobalValue(string key, int option) { return default(T); } public object Init() { return null; } public bool ReleaseSeqFile() { return true; } public void SetContext(object context) { } public void SetFileGlobalValue(string key, int option, T value) { } public void SetStationGlobalValue(string key, int option, T value, bool inContext = false) { } public object StartSequence(string filePath, string modelPath) { return null; } public bool WaitForExit() { return true; } } //public class Net47Getter : IRegGetter //{ // public string GetAppPath(string keyPath) // { // using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath)) // { // if (key == null) // { // throw new Exception("注册表不存在,请先运行一次编辑器"); // } // string value = key.GetValue("Location")?.ToString(); // if (string.IsNullOrEmpty(value)) // { // throw new Exception("注册表不存在,请先运行一次编辑器"); // } // return value; // } // } //} //public class TapWrapper : ITestExecutionWrapper, IResultListener //{ // TapThread testPlanThread; // TestPlan Plan; // TestPlanRun PlanRun; // public event PropertyChangedEventHandler PropertyChanged; // public event EventHandler UIMessageEvent; // public event EventHandler EndExecutionEvent; // public string Name { get; set; } // public bool IsConnected => true; // public object Init() // { // RegUtil.Register(new Net47Getter()); // StationGlobalsManager.Register(new DefaultStationGlobalsManager()); // VariableResolverFactory.Register(new DefaultVariableResolverFactory()); // ResultSettings.Current.Add(this); // return null; // } // private void PostUIMsgHandler_OnPostUIMsg(object sender, PostUIMsg e) // { // UIMessageEvent?.Invoke(this, new UIMessageEvent() // { // Origin = e, // EventCode = e.EventCode, // BoolData = e.BoolData, // NumberData = e.NumberData, // StrData = e.StringData // }); // } // public object StartSequence(string filePath, string modelPath) // { // Plan = TestPlan.Load(filePath); // testPlanThread = TapThread.Start(() => // { // var res = ResultSettings.Current; // Plan.Execute(ResultSettings.Current, null); // }); // return Plan; // } // public T GetFileGlobalValue(string key, int option) // { // return PlanRun.Resolve(null, $"FileGlobals.{key}"); // } // public T GetStationGlobalValue(string key, int option) // { // if (PlanRun == null) // { // return StationGlobalsManager.GetValue(key); // } // return PlanRun.Resolve(null, $"StationGlobals.{key}"); // } // public T GetValue(string key, int option) // { // return default(T); // } // public void SetValue(string key, T value, int option) // { // } // public void SetFileGlobalValue(string key, int option, T value) // { // PlanRun.Update(null, $"FileGlobals.{key}", value); // } // public void SetStationGlobalValue(string key, int option, T value, bool inContext = false) // { // if (PlanRun == null) // { // StationGlobalsManager.SetValue(key, value); // } // else // { // PlanRun.Update(null, $"StationGlobals.{key}", value); // } // } // public void CommitToDisk(bool option) // { // StationGlobalsManager.WriteToLocal(null); // } // public void OnTestPlanRunStart(TestPlanRun planRun) // { // PlanRun = planRun; // } // public void OnTestPlanRunCompleted(TestPlanRun planRun, Stream logStream) // { // } // public void OnTestStepRunStart(TestStepRun stepRun) // { // } // public void OnTestStepRunCompleted(TestStepRun stepRun) // { // } // public void OnResultPublished(Guid stepRunID, ResultTable result) // { // } // public void Open() // { // PostUIMsgHandler.OnPostUIMsg += PostUIMsgHandler_OnPostUIMsg; // } // public void Close() // { // PostUIMsgHandler.OnPostUIMsg -= PostUIMsgHandler_OnPostUIMsg; // EndExecutionEvent?.Invoke(this, new ExecutionEndEvent()); // PlanRun = null; // } // public bool WaitForExit() // { // return true; // } // public bool ReleaseSeqFile() // { // return true; // } // public void SetContext(object context) // { // } //} }