// 导入模板 void menuItem_importTemplate_Click(object sender, System.EventArgs e) { if (treeView_res.SelectedNode == null) { MessageBox.Show("请选择一个节点"); return; } if (treeView_res.SelectedNode.ImageIndex != ResTree.RESTYPE_SERVER) { MessageBox.Show("请选择一个服务器类型节点"); return; } ResPath respath = new ResPath(treeView_res.SelectedNode); /* * string strRefDbName = ""; * if (treeView_res.SelectedNode != null) * { * if (respath.Path != "") * { * string strPath = respath.Path; * strRefDbName = StringUtil.GetFirstPartPath(ref strPath); * } * } */ OpenFileDialog filedlg = new OpenFileDialog(); filedlg.FileName = "*.template"; // filedlg.InitialDirectory = Environment.CurrentDirectory; filedlg.Filter = "模板文件 (*.template)|*.template|All files (*.*)|*.*"; filedlg.RestoreDirectory = true; if (filedlg.ShowDialog() != DialogResult.OK) { return; } ImportTemplateDlg dlg = new ImportTemplateDlg(); MainForm.SetControlFont(dlg, this.DefaultFont); dlg.Url = respath.Url; dlg.FileName = filedlg.FileName; dlg.MainForm = this; dlg.ShowDialog(this); }
// 导入模板 void menuItem_importTemplate_Click(object sender, System.EventArgs e) { if (treeView_res.SelectedNode == null) { MessageBox.Show("请选择一个节点"); return; } if (treeView_res.SelectedNode.ImageIndex != ResTree.RESTYPE_SERVER) { MessageBox.Show("请选择一个服务器类型节点"); return; } ResPath respath = new ResPath(treeView_res.SelectedNode); /* string strRefDbName = ""; if (treeView_res.SelectedNode != null) { if (respath.Path != "") { string strPath = respath.Path; strRefDbName = StringUtil.GetFirstPartPath(ref strPath); } } */ OpenFileDialog filedlg = new OpenFileDialog(); filedlg.FileName = "*.template"; // filedlg.InitialDirectory = Environment.CurrentDirectory; filedlg.Filter = "模板文件 (*.template)|*.template|All files (*.*)|*.*" ; filedlg.RestoreDirectory = true ; if (filedlg.ShowDialog() != DialogResult.OK) { return; } ImportTemplateDlg dlg = new ImportTemplateDlg(); MainForm.SetControlFont(dlg, this.DefaultFont); dlg.Url = respath.Url; dlg.FileName = filedlg.FileName; dlg.MainForm = this; dlg.ShowDialog(this); }