// 编辑配置文件 void menu_editCfgFile(object sender, System.EventArgs e) { if (this.SelectedNode == null) { MessageBox.Show(this, "尚未选择要编辑的配置文件节点"); return; } if (this.SelectedNode.ImageIndex != ResTree.RESTYPE_FILE) { MessageBox.Show(this, "所选择的节点不是配置文件类型。请选择要编辑的配置文件节点。"); return; } string strPath = this.GetPath(this.SelectedNode); if (DatabaseObject.IsDefaultFile(strPath) == true && EnableDefaultFileEditing == false) { MessageBox.Show(this, "数据库缺省的配置文件不能在此进行修改。"); return; } DatabaseObject obj = this.Root.LocateObject(strPath); if (obj == null) { MessageBox.Show(this, "路径为 '" + strPath + "' 的内存对象没有找到..."); return; } // 编辑配置文件 CfgFileEditDlg dlg = new CfgFileEditDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.Initial(obj, strPath); /* dlg.Initial(this.Servers, this.Channels, this.stopManager, this.ServerUrl, strPath); */ if (this.applicationInfo != null) this.applicationInfo.LinkFormState(dlg, "CfgFileEditDlg_state"); dlg.ShowDialog(this); if (this.applicationInfo != null) this.applicationInfo.UnlinkFormState(dlg); if (dlg.DialogResult == DialogResult.OK) { // 把修改记录到日志 ObjEvent objevent = new ObjEvent(); objevent.Obj = obj; objevent.Oper = ObjEventOper.Change; objevent.Path = strPath; this.Log.Add(objevent); } }
// 编辑配置文件 void menu_editCfgFile(object sender, System.EventArgs e) { if (this.SelectedNode == null) { MessageBox.Show(this, "尚未选择要编辑的配置文件节点"); return; } if (this.SelectedNode.ImageIndex != RESTYPE_FILE) { MessageBox.Show(this, "所选择的节点不是配置文件类型。请选择要编辑的配置文件节点。"); return; } ResPath respath = new ResPath(this.SelectedNode); // 编辑配置文件 CfgFileEditDlg dlg = new CfgFileEditDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.Initial(this.Servers, this.Channels, this.stopManager, respath.Url, respath.Path); if (this.AppInfo != null) this.AppInfo.LinkFormState(dlg, "CfgFileEditDlg_state"); dlg.ShowDialog(this); if (this.AppInfo != null) this.AppInfo.UnlinkFormState(dlg); /* if (dlg.DialogResult != DialogResult.OK) goto FINISH; */ }