public void AddResultDisplayListener(string name) { int i = 0; var items = ResultDisplayInfos.Where(x => x.Name == name); ResultDisplayInfo displayInfo = new ResultDisplayInfo() { Name = name }; if (items.Count() != 0) { i = ResultDisplayInfos.Select(x => x.Index).Max(); displayInfo.Index = i + 1; displayInfo.DisplayName = name + displayInfo.Index; } else { displayInfo.DisplayName = name; displayInfo.Index = 0; } var resultDisplayType = TestStepFactory.ResultDisplaylist.Where(x => x.Att.DisplayName == name).FirstOrDefault(); if (resultDisplayType is ResultDisplayType) { ResultDisplayType type = resultDisplayType as ResultDisplayType; Assembly assembly = Assembly.LoadFile(type.AssemblyPath); string str = type.ResultType.FullName; Type modelType = assembly.GetType(str); object obj = Activator.CreateInstance(modelType) as object; if (obj is IResultListerner) { displayInfo.ResultListener = obj as IResultListerner; } ResultDisplayInfos.Add(displayInfo); } }
public void DeleteResultDisplayListener(ResultDisplayInfo info) { ResultDisplayInfos.Remove(info); }