void DoTest(tmTreeNode itemTree, object obj) { DictionaryEx dic = obj as DictionaryEx; TestEngine engine = dic["engine"] as TestEngine; int id = (int)dic["id"]; ScriptEngine se = engine.GetScriptEngine(id) as ScriptEngine; foreach (tmTreeNode c in itemTree.ChildNodes()) { if (c.ChildNodes().Count > 0) //key item { DoTest(c, obj); continue; } TestItem t = c.RepresentObject() as TestItem; m_SyncEvent[id].Set(); UUT_SYNCH(0); Thread.Sleep(1000); object[] value = Execute_Item(se, t); } }
int OnLoadProfile(Notification nf) { try { DictionaryEx dic = nf.context as DictionaryEx; tmTreeNode ItemTree = dic["items"] as tmTreeNode; lvTestItem.ShowGroups = false; List <tmTreeNode> Root = ItemTree.ChildNodes(); int index = 0; int casenum = 0; lvTestItem.Items.Clear(); foreach (tmTreeNode t in Root) { TestItem aItem = t.RepresentObject() as TestItem; if (t.ChildNodes().Count > 0) //Group { //Create Group; ListViewGroup group = lvTestItem.Groups.Add(aItem["name"] as string, aItem["name"] as string); List <tmTreeNode> child = t.ChildNodes(); foreach (tmTreeNode c in child) { TestItem subitem = c.RepresentObject() as TestItem; string testcase; if (TestContext.testcaseList.Count > 0) { testcase = TestContext.testcaseList[casenum++]; } if (subitem.ContainsKey("visible")) { int v = Convert.ToInt32(subitem["visible"]); if (v == 0) { continue; //no need show } } ListViewItem lvItem = new ListViewItem(index++.ToString()); List <string> arrSub = new List <string>(); //后边再处理lxl arrSub.Add(subitem["name"] as string); if (subitem.ContainsKey("lower")) { arrSub.Add(subitem["lower"] as string); } else { arrSub.Add(""); } if (subitem.ContainsKey("upper")) { arrSub.Add(subitem["upper"] as string); } else { arrSub.Add(""); } arrSub.Add(""); //time arrSub.Add(""); //UUT1 arrSub.Add(""); //UUT2 arrSub.Add(""); //UUT3 arrSub.Add(""); //UUT4 arrSub.Add(""); //UUT5 arrSub.Add(""); //UUT6 if (subitem.ContainsKey("unit")) { arrSub.Add(subitem["unit"] as string); } else { arrSub.Add(""); } if (subitem.ContainsKey("remark")) { arrSub.Add(subitem["remark"] as string); } else { arrSub.Add(""); } lvItem.SubItems.AddRange(arrSub.ToArray()); lvItem.Group = group; lvTestItem.Items.Add(lvItem); } } } //lxl 根据具体的脚本加载不同的 string module = dic["Module"] as string; if (module != null) { lbTestName.Text = module; if (module.CompareTo("Alsar Glass test") == 0) { } else { } } string version = dic["Version"] as string; if (version != null) { lbscriptver.Text = version; } } catch (System.Exception exp) { MessageBox.Show(exp.Message, exp.Source); } return(0); }