private void AddUCLocalSetting(TestStep step, string displayName) { var item = TestStepInfoMgr.Instance.TestStepInfoList.Where(x => x.StepType == step.GetType()).Select(x => x.LocalSettingViewStr).FirstOrDefault(); var temp = TestStepInfoMgr.Instance.TestStepInfoList.Where(x => x.StepType == step.GetType()); if (item != null) { string folderName = AppDomain.CurrentDomain.BaseDirectory; string[] strs = item.Split(';'); string fullName = folderName + strs[0]; Assembly assembly = Assembly.LoadFile(fullName); Type modelType = assembly.GetType(strs[1]); object obj = Activator.CreateInstance(modelType) as object; UserControl uc = obj as UserControl; uc.DataContext = step; if (uc != null) { UCLocalSetting ucLocalSetting = new UCLocalSetting() { StepDisplayName = displayName, UserControl = uc, DisplayName = displayName + " " + step.PathConfigName }; uCLocalSettingList.Add(ucLocalSetting); } } }
void getSelectedUC() { FilterUCList.Clear(); foreach (TreeNodeVM node in manualConnList) { foreach (TreeNodeVM subNode in node.SubTreeNodeList) { if (subNode.IsSelected) { var item = UCLocalSettingList.Where(x => x.StepDisplayName == subNode.Name).FirstOrDefault(); if (item != null) { UCLocalSetting uc = item as UCLocalSetting; FilterUCList.Add(uc); } } } } }