private void button_dtlp_dupCfg_Click(object sender, EventArgs e) { string strError = ""; DtlpSearchForm dtlp_searchform = this.MainForm.GetDtlpSearchForm(); if (dtlp_searchform == null) { strError = "无法获得打开的DTLP检索窗,无法配置查重"; goto ERROR1; } DupCfgDialog dlg = new DupCfgDialog(); GuiUtil.SetControlFont(dlg, this.Font); int nRet = dlg.Initial(this.MainForm.DataDir + "\\dtlp_dup.xml", out strError); if (nRet == -1) { goto ERROR1; } dlg.DtlpChannels = dtlp_searchform.DtlpChannels; dlg.DtlpChannel = dtlp_searchform.DtlpChannel; // dlg.StartPosition = FormStartPosition.CenterScreen; this.MainForm.AppInfo.LinkFormState(dlg, "dupcfg_dialogdialog_state"); dlg.ShowDialog(this); this.MainForm.AppInfo.UnlinkFormState(dlg); return; ERROR1: MessageBox.Show(this, strError); }
DtlpSearchForm GetDtlpSearchForm() { DtlpSearchForm dtlp_searchform = null; dtlp_searchform = this.m_mainForm.TopDtlpSearchForm; if (dtlp_searchform == null) { // 新开一个dtlp检索窗 FormWindowState old_state = this.WindowState; dtlp_searchform = new DtlpSearchForm(); dtlp_searchform.MainForm = this.m_mainForm; dtlp_searchform.MdiParent = this.m_mainForm; dtlp_searchform.WindowState = FormWindowState.Minimized; dtlp_searchform.Show(); this.WindowState = old_state; this.Activate(); // 需要等待初始化操作彻底完成 dtlp_searchform.WaitLoadFinish(); } return dtlp_searchform; }
// 装载MARC记录,根据记录路径 // parameters: // strPath 路径。例如 "localhost/图书总库/ctlno/1" public int LoadDtlpRecord(DtlpSearchForm dtlp_searchform, string strPath, string strDirection, bool bLoadResObject) { string strError = ""; if (dtlp_searchform == null) { strError = "dtlp_searchform参数不能为空"; goto ERROR1; } Debug.Assert(dtlp_searchform.CurrentProtocol == dtlp_searchform.CurrentProtocol.ToLower(), "协议名应当采用小写"); if (dtlp_searchform.CurrentProtocol != "dtlp") { strError = "所提供的检索窗不是dtlp协议"; goto ERROR1; } DigitalPlatform.Z3950.Record record = null; Encoding currentEncoding = null; this.CurrentRecord = null; byte[] baTimestamp = null; string strOutStyle = ""; string strOutputPath = ""; string strMARC; long lVersion = 0; LoginInfo logininfo = null; string strXmlFragment = ""; int nRet = dtlp_searchform.GetOneRecord( "marc", // strPath, // strDirection, 0, // test "path:" + strPath + ",direction:" + strDirection, "", out strOutputPath, out strMARC, out strXmlFragment, out strOutStyle, out baTimestamp, out lVersion, out record, out currentEncoding, out logininfo, out strError); if (nRet == -1) goto ERROR1; this.domXmlFragment = null; this.CurrentTimestamp = baTimestamp; this.SavePath = dtlp_searchform.CurrentProtocol + ":" + strOutputPath; this.CurrentEncoding = currentEncoding; /* // 接着装入对象资源 if (bLoadResObject == true) { this.binaryResControl1.Channel = dp2_searchform.GetChannel(dp2_searchform.GetServerUrl(strServerName)); nRet = this.binaryResControl1.LoadObject(strLocalPath, strRecordXml, out strError); if (nRet == -1) { MessageBox.Show(this, strError); return -1; } }*/ // 装入MARC编辑器 this.MarcEditor.Marc = strMARC; this.CurrentRecord = record; if (this.m_currentRecord != null) { // 装入二进制编辑器 this.binaryEditor_originData.SetData( this.m_currentRecord.m_baRecord); // 装入ISO2709文本 nRet = this.Set2709OriginText(this.m_currentRecord.m_baRecord, this.CurrentEncoding, out strError); if (nRet == -1) { this.textBox_originData.Text = strError; } // 数据库名 this.textBox_originDatabaseName.Text = this.m_currentRecord.m_strDBName; // Marc syntax OID this.textBox_originMarcSyntaxOID.Text = this.m_currentRecord.m_strSyntaxOID; // 让确定的OID起作用 2008/3/25 if (String.IsNullOrEmpty(this.m_currentRecord.m_strSyntaxOID) == false) this.AutoDetectedMarcSyntaxOID = ""; } else { byte[] baMARC = this.CurrentEncoding.GetBytes(strMARC); // 装入二进制编辑器 this.binaryEditor_originData.SetData( baMARC); // 装入ISO2709文本 nRet = this.Set2709OriginText(baMARC, this.CurrentEncoding, out strError); if (nRet == -1) { this.textBox_originData.Text = strError; } } // 构造路径 /* string strPath = searchform.CurrentProtocol + ":" + searchform.CurrentResultsetPath + "/" + (index + 1).ToString(); this.textBox_tempRecPath.Text = strPath; * */ this.textBox_tempRecPath.Text = ""; this.MarcEditor.MarcDefDom = null; // 强制刷新字段名提示 this.MarcEditor.RefreshNameCaption(); this.BiblioChanged = false; if (this.MarcEditor.FocusedFieldIndex == -1) this.MarcEditor.FocusedFieldIndex = 0; this.MarcEditor.Focus(); return 0; ERROR1: MessageBox.Show(this, strError); return -1; }
DtlpSearchForm GetDtlpSearchForm() { DtlpSearchForm dtlp_searchform = null; if (this.LinkedSearchForm != null && this.LinkedSearchForm is DtlpSearchForm) { dtlp_searchform = (DtlpSearchForm)this.LinkedSearchForm; } else { dtlp_searchform = this.MainForm.TopDtlpSearchForm; if (dtlp_searchform == null) { // 新开一个dtlp检索窗 dtlp_searchform = new DtlpSearchForm(); dtlp_searchform.MainForm = this.MainForm; dtlp_searchform.MdiParent = this.MainForm; dtlp_searchform.WindowState = FormWindowState.Minimized; dtlp_searchform.Show(); } } return dtlp_searchform; }