/// <summary> /// 新建专案 /// 专案就是可以创建生产线的地方 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuGroupPlotNew_Click(object sender, EventArgs e) { if (treeV.SelectedNode != null) { OpenPlot sPlot = OpenPlot.CreatePlot(); sPlot.Path = treeV.SelectedNode.Tag.ToString(); FrmPlotInfo sFrmPlotInfo = new FrmPlotInfo(sPlot, true); if (sFrmPlotInfo.ShowDialog() == DialogResult.OK) { string sFileName = treeV.SelectedNode.Tag.ToString() + "\\" + sPlot.Name + ".opp"; //保存专案到本地文件 if (CrawlServer.SaveAs(sFileName, sPlot)) { TreeNode sNode = new TreeNode(sPlot.Name, 2, 2); sNode.Tag = sPlot; //在给专案树Tag赋值完,将专案添加到缓冲池 CrawlServer.AddPlot2Pool(sPlot); treeV.SelectedNode.Nodes.Add(sNode); //专案树字典 mTreeNodeDic[sFileName] = sNode; treeV.SelectedNode = sNode; } } } }
/// <summary> /// 加载专案文件 /// </summary> /// <param name="pPath"></param> /// <param name="pNode"></param> /// <param name="pNodeDic"></param> public void LoadFile(string pPath, TreeNode pNode, Dictionary <string, TreeNode> pNodeDic) { string[] sFiles = DirFileHelper.GetFileNames(pPath); int k = pPath.Length + 1; if (sFiles != null) { for (int i = 0; i < sFiles.Length; i++) { OpenPlot sPlot = CrawlServer.Open(sFiles[i]); if (sPlot == null) { continue; } TreeNode sNode = new TreeNode(sPlot.Name, 2, 2); sNode.Tag = sPlot; CrawlServer.AddPlot2Pool(sPlot); pNodeDic[sFiles[i]] = sNode; pNode.Nodes.Add(sNode); } } }