private void QueryForestByGeometry(IGeometry pGeometry, IMap pMap) { //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); try { string strNodeKey = SysCommon.ModSysSetting.GetLinBanLayerNodeKey(Plugin.ModuleCommon.TmpWorkSpace); ILayer pLayer = SysCommon.ModuleMap.GetLayerByNodeKey(null, pMap, strNodeKey, null, true); SysCommon.BottomQueryBar pQueryBar = _hook.QueryBar; if (pQueryBar.m_WorkSpace == null) { pQueryBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (pQueryBar.ListDataNodeKeys == null) { pQueryBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID; } pQueryBar.m_pMapControl = _hook.MapControl; //构造查询过滤器 ISpatialFilter pQueryFilter = new SpatialFilterClass(); pQueryFilter.Geometry = pGeometry; pQueryFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; pQueryBar.m_pMapControl = _hook.MapControl; vProgress.SetProgress("获取查询结果..."); pQueryBar.EmergeQueryData(pLayer as IFeatureLayer, pQueryFilter, vProgress); vProgress.Close(); //pQueryBar.EmergeQueryData(pMap, pGeometry, esriSpatialRelEnum.esriSpatialRelIntersects); try { DevComponents.DotNetBar.Bar pBar = pQueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; //pBar.SelectedDockTab = 1; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } } catch { vProgress.Close(); } vProgress = null; }
public override void OnClick() { if (_AppHk == null) { return; } if (_AppHk.MainUserControl == null) { return; } if (_AppHk.MapControl.LayerCount == 0) { DevComponents.DotNetBar.MessageBoxEx.Show("未加载数据!", "提示!"); return; } string LinBanLayerKey = "", LinBanCodeField = "", XzqField = ""; string playerTreePath = Application.StartupPath + "\\..\\res\\xml\\展示图层树0.xml"; string strConfigPath = Application.StartupPath + "\\..\\res\\xml\\林班号查询.xml"; SysCommon.ModSysSetting.CopyConfigXml(Plugin.ModuleCommon.TmpWorkSpace, "最大林斑号", strConfigPath); //20130312 ygc 复制配置树到相应的位置 SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, playerTreePath); GetConfig(strConfigPath, out LinBanLayerKey, out LinBanCodeField, out XzqField); IFeatureClass _LinBanFeatureClass = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, playerTreePath, LinBanLayerKey); try { System.IO.File.Delete(strConfigPath); System.IO.File.Delete(playerTreePath); } catch { } if (_LinBanFeatureClass == null) { DevComponents.DotNetBar.MessageBoxEx.Show("未添加林斑数据!", "提示!"); return; } //添加进度条 ygc 2012-10-8 SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = false; vProgress.EnableUserCancel(false); vProgress.MaxValue = 9; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); vProgress.SetProgress("正在进行八大类总体统计"); ModCommon.DoEightStatistics(_LinBanFeatureClass, "xbmj", vProgress); vProgress.Close(); //MessageBox.Show("统计成功!", "提示"); DevComponents.DotNetBar.MessageBoxEx.Show("统计成功!", "提示"); }
//添加记录菜单响应 public override void OnClick() { if (m_Hook.GridCtrl == null) { return; } FaceControl pFaceControl = (FaceControl)m_Hook.MainUserControl; DataGridView pGridControl = m_Hook.GridCtrl; if (pFaceControl.getEditable() == false) { return; } string Tablename = ""; //获取数据库连接串和表名 Tablename = pFaceControl.m_TableName; SaveFileDialog pOpenFileDlg = new SaveFileDialog(); pOpenFileDlg.Title = "设置导出Excel文件的名称"; pOpenFileDlg.Filter = "Excel文件(*.xls)|*.xls"; if (pOpenFileDlg.ShowDialog() != DialogResult.OK) { return; } string strFileName = pOpenFileDlg.FileName; //加进度条 chulili 2013-01-11 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = false; vProgress.TopMost = true; bool bRes = ModExcel.ExportTableToExcel(Plugin.ModuleCommon.TmpWorkSpace, Tablename, strFileName, vProgress); vProgress.Close(); if (bRes) { MessageBox.Show("导出成功!"); } //ModDBOperate.ExportTableToExcel(Tablename, strFileName); if (this.WriteLog) { Plugin.LogTable.Writelog(Caption);//xisheng 2011.07.09 增加日志 } }
private void toolAnalysisChange_Click(object sender, EventArgs e) { if (_OldFeatureClass == null || _NewFeatureClass == null) { MessageBox.Show("请先添加新旧数据!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; }//ygc 20130316 新增错误保护! IEnvelope pEnv = ucHistoryMap1.AxMapCtrlHis.Extent; SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); _Progress = vProgress; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("创建临时结果文件"); bool bRes = CreateMdbDatabase(); if (!bRes) { vProgress.Close(); vProgress = null; return; } bool bRes2 = DoIntersect(_OldFeatureClass, _NewFeatureClass, pEnv as IGeometry); if (!bRes2) { vProgress.Close(); vProgress = null; return; } DoAttriAnalysis(); if (_Progress != null) { _Progress.Close(); _Progress = null; } DeleteMdb(); }
//检查一个图层中的错误信息 public static Dictionary <string, int> CheckFeautreClass(IFeatureClass pFeatureClass, Dictionary <string, string> dicCondition, out Exception ex) { ex = null; if (pFeatureClass == null) { return(null); } if (dicCondition == null || dicCondition.Count == 0) { return(null); } Dictionary <string, int> newdic = new Dictionary <string, int>(); SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = false; vProgress.EnableUserCancel(false); vProgress.MaxValue = dicCondition.Count; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); vProgress.SetProgress("正在检查" + pFeatureClass.AliasName + "数据......"); foreach (string key in dicCondition.Keys) { int featureCount = CheckSingleCondition(pFeatureClass, dicCondition[key], out ex); if (ex != null) { newdic.Add(key, -1); } else { newdic.Add(key, featureCount); } vProgress.ProgresssValue = vProgress.ProgresssValue + 1; } vProgress.Close(); return(newdic); }
private void btnOK_Click(object sender, EventArgs e) { //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); this.DialogResult = DialogResult.OK; //没有当前图层直接退出 if (m_pCurrentLayer == null) { vProgress.Close();// 张琪 20110705 添加 return; } try { string whereClause = this.richTextExpression.Text.Trim(); //获取当前图层的 featureclass vProgress.SetProgress("获取当前图层"); IFeatureClass pFeatClass = m_pCurrentLayer.FeatureClass; //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); //赋值查许条件 vProgress.SetProgress("构造查询过滤器并赋值查询条件"); pQueryFilter.WhereClause = whereClause; //赋值查询方式,由查询方式的combo获得 esriSelectionResultEnum pSelectionResult; pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; //进行查询,并将结果显示出来 vProgress.SetProgress("正在查询符合条件的结果"); //frmQuery frm = new frmQuery(m_MapControlDefault); //frm.FillData(m_pCurrentLayer, pQueryFilter, pSelectionResult); _QueryBar.m_pMapControl = m_MapControlDefault; _QueryBar.EmergeQueryData(m_MapControlDefault.Map, m_pCurrentLayer, pQueryFilter, pSelectionResult, vProgress); try { DevComponents.DotNetBar.Bar pBar = _QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; //pBar.SelectedDockTab = 1; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } } //frm.Show(); catch { } finally { vProgress.Close(); this.Hide(); this.Dispose(true); } }
private void UploadingResults(TreeNode rootNode) { if (rootNode == null) { return; } if (!Directory.Exists((rootNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim())) { return; } System.Windows.Forms.FolderBrowserDialog sOpenFileD = new System.Windows.Forms.FolderBrowserDialog(); sOpenFileD.RootFolder = Environment.SpecialFolder.Desktop; if (sOpenFileD.ShowDialog() == DialogResult.OK) { if (!sOpenFileD.SelectedPath.ToLower().EndsWith("gdb")) { MessageBox.Show("请选择gdb数据库文件夹", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string strPathName = sOpenFileD.SelectedPath; string strDirtoryName = strPathName.Substring(strPathName.LastIndexOf("\\") + 1); Dictionary <string, string> pDic = new Dictionary <string, string>(); if (Directory.Exists(strPathName.ToString())) { string strPath = (rootNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim() + "\\" + strDirtoryName; if (!ModStringpro.IsSameTreeNode(rootNode, strDirtoryName, strPath)) { SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowProgress(); Application.DoEvents(); vProgress.SetProgress("正在上传GDB数据....."); try { ModStringpro.CopyDirectory(strPathName, (rootNode.Tag as Dictionary <string, string>)["Path"].ToString(), vProgress); vProgress.Close(); } catch { pDic.Add(strDirtoryName, "文件上传失败"); vProgress.Close(); return; } DirectoryInfo fi = new DirectoryInfo(strPath); if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1) { fi.Attributes = FileAttributes.Normal; } TreeNode ResultsNode = new TreeNode(strDirtoryName); //创建文件类型新节点 Dictionary <string, string> pDicTag = new Dictionary <string, string>(); pDicTag.Add("Path", strPath); pDicTag.Add("Type", "GDB"); ResultsNode.Tag = pDicTag; ResultsNode.ImageKey = "PDB"; ResultsNode.SelectedImageKey = "PDB"; rootNode.Nodes.Add(ResultsNode); rootNode.Expand(); pDic.Add(strDirtoryName, "数据上传成功"); } else { pDic.Add(strDirtoryName, "目录中已经存在"); } } frmUploadingList pfrmUploadingList = new frmUploadingList(pDic); pfrmUploadingList.ShowDialog(); } }
public override void OnClick() { Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef; SysCommon.BottomQueryBar pBar = phook.QueryBar; if (pBar.m_WorkSpace == null) { pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (_AppHk == null) { return; } if (_AppHk.MapControl == null) { return; } IMap pMap = _AppHk.MapControl.Map; if (frmSQL != null) { frmSQL.Close(); frmSQL = null; } if (WriteLog) { Plugin.LogTable.Writelog("打开查询方案"); //ygc 2012-9-14 写日志 } SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = false; vProgress.FakeProgress = true; vProgress.TopMost = true; //vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); FrmOpenSQLCondition newfrm = new FrmOpenSQLCondition(Plugin.ModuleCommon.TmpWorkSpace); newfrm.m_TableName = "SQLSOLUTION"; newfrm.m_showAllLayer = true; if (newfrm.ShowDialog() != DialogResult.OK) { return; } vProgress.ShowProgress(); string strSQL = newfrm.m_Condition; string layerName = newfrm.m_LayerName; if (strSQL == "") { MessageBox.Show("未选择查看的查询方案!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); return; } IFeatureLayer pFeatureLayer = GetLayerByName(layerName, pMap); if (pFeatureLayer == null) { MessageBox.Show("当前地图无该查询方案图层!", "提示"); return; } //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = strSQL; esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; vProgress.SetProgress("正在查询符合条件的结果"); pBar.m_pMapControl = _AppHk.MapControl; pBar.EmergeQueryData(_AppHk.MapControl.Map, pFeatureLayer, pQueryFilter, pSelectionResult, vProgress); vProgress.Close(); try { DevComponents.DotNetBar.Bar pBar0 = pBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar0 != null) { pBar0.AutoHide = false; //pBar0.SelectedDockTab = 1; int tmpindex = pBar0.Items.IndexOf("dockItemDataCheck"); pBar0.SelectedDockTab = tmpindex; } } catch { } }
private void btnOK_Click(object sender, EventArgs e) { //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); bool bRes = false; //是否查询到地物 this.DialogResult = DialogResult.OK; //没有当前图层直接退出 if (m_pCurrentLayer == null) { vProgress.Close();// 张琪 20110705 添加 return; } try { string whereClause = this.richTextExpression.Text.Trim(); if (CheckExpression(whereClause, false) == false) //changed by chulili 20120818 不弹提示框 { vProgress.Close(); // 张琪 20110705 添加 MessageBox.Show("此表达式搜索不到要素,请检查表达式", "提示"); return; } //获取当前图层的 featureclass vProgress.SetProgress("获取当前图层"); IFeatureClass pFeatClass = m_pCurrentLayer.FeatureClass; //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); //赋值查许条件 vProgress.SetProgress("构造查询过滤器并赋值查询条件"); pQueryFilter.WhereClause = whereClause; //赋值查询方式,由查询方式的combo获得 esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; bool bSelection = true; switch (this.cmbselmode.SelectedItem.ToString()) { case ("不创建选择结果"): bSelection = false; break; case ("创建一个新的选择结果"): pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; break; case ("添加到当前选择集中"): pSelectionResult = esriSelectionResultEnum.esriSelectionResultAdd; break; case ("从当前选择结果中移除"): pSelectionResult = esriSelectionResultEnum.esriSelectionResultSubtract; break; case ("从当前选择结果中选择"): pSelectionResult = esriSelectionResultEnum.esriSelectionResultAnd; break; default: vProgress.Close(); // 张琪 20110705 添加 return; } //进行查询,并将结果显示出来 vProgress.SetProgress("正在查询符合条件的结果"); //frmQuery frm = new frmQuery(m_MapControlDefault); //frm.FillData(m_pCurrentLayer, pQueryFilter, pSelectionResult); _QueryBar.m_pMapControl = m_MapControlDefault; if (!bSelection) { _QueryBar.EmergeQueryData(m_pCurrentLayer, pQueryFilter, vProgress); } else { _QueryBar.EmergeQueryData(m_MapControlDefault.Map, m_pCurrentLayer, pQueryFilter, pSelectionResult, vProgress); } try { DevComponents.DotNetBar.Bar pBar = _QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } bRes = true; } //frm.Show(); catch { } finally { vProgress.Close(); if (bRes) { this.Hide(); this.Dispose(true); } } }
private void QueryForestByAttri(DevComponents.AdvTree.Node pXZQnode, IMap pMap) { if (pXZQnode == null) { return; } //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); try { string strTag = pXZQnode.Tag.ToString(); string strCode = pXZQnode.Name; if (strTag.ToUpper() == "TOWN") { DevComponents.AdvTree.Node pParentNode = pXZQnode.Parent; string strTmpCode = pParentNode.Name; strCode = strTmpCode + strCode.Substring(1, 2); } string strNodeKey = SysCommon.ModSysSetting.GetLinBanLayerNodeKey(Plugin.ModuleCommon.TmpWorkSpace); ILayer pLayer = SysCommon.ModuleMap.GetLayerByNodeKey(null, pMap, strNodeKey, null, true); SysCommon.BottomQueryBar pQueryBar = _hook.QueryBar; if (pQueryBar.m_WorkSpace == null) { pQueryBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (pQueryBar.ListDataNodeKeys == null) { pQueryBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID; } esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); //ygc 20130326 根据山西数据格式修改条件合成方式 if (strTag.ToUpper() == "TOWN") { pQueryFilter.WhereClause = "xiang ='" + strCode + "00'"; } else if (strTag.ToUpper() == "County") { pQueryFilter.WhereClause = "XIANG = '" + strCode + "'"; } else if (strTag.ToUpper() == "City") { pQueryFilter.WhereClause = "shi = '" + strCode + "00'"; } else { pQueryFilter.WhereClause = "XIANG like '" + strCode + "%'"; } pQueryBar.m_pMapControl = _hook.MapControl; vProgress.SetProgress("获取查询结果..."); pQueryBar.EmergeQueryData(pLayer as IFeatureLayer, pQueryFilter, vProgress); vProgress.Close(); try { DevComponents.DotNetBar.Bar pBar = pQueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; //pBar.SelectedDockTab = 1; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } } catch { vProgress.Close(); } vProgress = null; }
/// <summary> /// 清空指定的文件夹,但不删除文件夹 /// </summary> /// <param name="dir"></param> private bool CopyResults(string dir, string strCopyPath, string strTpye) { switch (strTpye) { case "File": if (File.Exists(dir)) { FileInfo fi = new FileInfo(dir); if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1) { fi.Attributes = FileAttributes.Normal; } try { fi.CopyTo(strCopyPath + "\\" + fi.Name, true); } catch { return(false); } } else { return(false); } break; case "Folder": if (Directory.Exists(dir)) { SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowProgress(); Application.DoEvents(); vProgress.SetProgress("正在导出目录....."); string flag = ModStringpro.CopyFolder(dir, strCopyPath, vProgress); vProgress.Close(); if (flag != "success") { return(false); } } else { return(false); } break; case "GDB": if (Directory.Exists(dir)) { SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowProgress(); Application.DoEvents(); vProgress.SetProgress("正在导出GDB数据....."); try { ModStringpro.CopyDirectory(dir, strCopyPath, vProgress); vProgress.Close(); } catch { vProgress.Close(); return(false); } } else { return(false); } break; } return(true); }
private void UploadingResults(TreeNode rootNode) { if (rootNode == null) { return; } if (!Directory.Exists((rootNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim())) { return; } System.Windows.Forms.OpenFileDialog sOpenFileD = new System.Windows.Forms.OpenFileDialog(); sOpenFileD.CheckFileExists = true; sOpenFileD.CheckPathExists = true; sOpenFileD.Multiselect = true; sOpenFileD.Title = "选择文件"; sOpenFileD.Filter = "制图文件(*.mxd)|*.mxd|Excel工作薄 (*.xls;*.xlsx)|*.xls;*.xlsx|Word(*.doc;*.docx)|*.doc;*.docx|Text 文档(*.txt)|*.txt|PDF 文档(*.pdf)|*.pdf|图片文件 (*.jpg;*.png;*.bmp)|*.jpg;*.png;*.bmp"; if (sOpenFileD.ShowDialog() == DialogResult.OK) { Dictionary <string, string> pDic = new Dictionary <string, string>(); string[] strFileName = sOpenFileD.FileNames; SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.MaxValue = strFileName.Length; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); vProgress.SetProgress("正在上传....."); for (int j = 0; j < strFileName.Length; j++) { vProgress.SetProgress("正在上传:" + Path.GetFileName(strFileName[j].ToString()) + "成果......"); vProgress.ProgresssValue = vProgress.ProgresssValue + 1; if (vProgress.UserAskCancel) { vProgress.Close(); break; } if (File.Exists(strFileName[j].ToString())) { string strPath = (rootNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim() + "\\" + Path.GetFileName(strFileName[j].ToString()); if (!ModStringpro.IsSameTreeNode(rootNode, Path.GetFileName(strPath), strPath)) { if (!ModStringpro.copyDirectory(strFileName[j].ToString(), strPath)) { pDic.Add(Path.GetFileName(strFileName[j].ToString()), "文件上传失败"); continue; } FileInfo fi = new FileInfo(strPath); if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1) { fi.Attributes = FileAttributes.Normal; } TreeNode ResultsNode = new TreeNode(Path.GetFileName(strPath)); //创建文件类型新节点 Dictionary <string, string> pDicTag = new Dictionary <string, string>(); pDicTag.Add("Path", strPath); pDicTag.Add("Type", "File"); ResultsNode.Tag = pDicTag; switch (Path.GetExtension(strPath).ToLower()) { case ".mxd": ResultsNode.ImageKey = "ArcMap"; ResultsNode.SelectedImageKey = "ArcMap"; break; case ".doc": case ".docx": ResultsNode.ImageKey = "word"; ResultsNode.SelectedImageKey = "word"; break; case ".xls": case ".xlsx": ResultsNode.ImageKey = "excel"; ResultsNode.SelectedImageKey = "excel"; break; case ".jpg": case ".bmp": case ".png": case ".img": case ".jpeg": case ".gif": ResultsNode.ImageKey = "images"; ResultsNode.SelectedImageKey = "images"; break; case ".txt": ResultsNode.ImageKey = "text"; ResultsNode.SelectedImageKey = "text"; break; case ".pdf": ResultsNode.ImageKey = "pdf"; ResultsNode.SelectedImageKey = "pdf"; break; } rootNode.Nodes.Add(ResultsNode); rootNode.Expand(); pDic.Add(Path.GetFileName(strFileName[j].ToString()), "文件上传成功"); } else { pDic.Add(Path.GetFileName(strFileName[j].ToString()), "目录中已经存在"); } } } vProgress.Close(); Application.DoEvents(); frmUploadingList pfrmUploadingList = new frmUploadingList(pDic); pfrmUploadingList.ShowDialog(); } }