// 获得错误信息窗 internal HtmlViewerForm GetErrorInfoForm() { if (this.ErrorInfoForm == null || this.ErrorInfoForm.IsDisposed == true || this.ErrorInfoForm.IsHandleCreated == false) { this.ErrorInfoForm = new HtmlViewerForm(); this.ErrorInfoForm.ShowInTaskbar = false; this.ErrorInfoForm.Text = "错误信息"; this.ErrorInfoForm.Show(this); this.ErrorInfoForm.WriteHtml("<pre>"); // 准备文本输出 } return(this.ErrorInfoForm); }
private void MenuItem_marcEditor_getSummary_Click(object sender, EventArgs e) { string strError = ""; if (string.IsNullOrEmpty(this.BiblioRecPath)) { strError = "当前书目记录为空,无法获得书目记录摘要"; goto ERROR1; } string strBiblioSummary = ""; LibraryChannel channel = this.GetChannel(); TimeSpan old_timeout = channel.Timeout; channel.Timeout = new TimeSpan(0, 1, 0); Progress.OnStop += new StopEventHandler(this.DoStop); Progress.Initial("正在获得书目记录摘要"); Progress.BeginLoop(); try { string[] formats = new string[1]; formats[0] = "summary"; string[] results = null; byte[] timestamp = null; long lRet = channel.GetBiblioInfos( stop, this.BiblioRecPath, "", formats, out results, out timestamp, out strError); if (lRet == -1 || lRet == 0) { if (lRet == 0 && String.IsNullOrEmpty(strError) == true) strError = "书目记录 '" + this.BiblioRecPath + "' 不存在"; goto ERROR1; } else { Debug.Assert(results != null && results.Length == 1, "results必须包含 1 个元素"); strBiblioSummary = results[0]; } } finally { EnableControls(true); Progress.EndLoop(); Progress.OnStop -= new StopEventHandler(this.DoStop); Progress.Initial(""); channel.Timeout = old_timeout; this.ReturnChannel(channel); } HtmlViewerForm dlg = new HtmlViewerForm(); dlg.Text = "书目记录摘要"; dlg.HtmlString = strBiblioSummary; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); return; ERROR1: MessageBox.Show(this, strError); }
// 书目库属性 private void MenuItem_viewBiblioDbProperty_Click(object sender, EventArgs e) { HtmlViewerForm dlg = new HtmlViewerForm(); MainForm.SetControlFont(dlg, this.Font, false); string strText = "<html><body>"; // Debug.Assert(false, ""); if (this.MainForm.BiblioDbProperties != null) { for (int i = 0; i < this.MainForm.BiblioDbProperties.Count; i++) { BiblioDbProperty property = this.MainForm.BiblioDbProperties[i]; strText += "<p>书目库名: " + property.DbName + "; 语法: " + property.Syntax + "</p>"; } } strText += "</body></html>"; dlg.HtmlString = strText; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(); // ? this }
// 获得错误信息窗 HtmlViewerForm GetErrorInfoForm() { if (this.ErrorInfoForm == null || this.ErrorInfoForm.IsDisposed == true || this.ErrorInfoForm.IsHandleCreated == false) { this.ErrorInfoForm = new HtmlViewerForm(); this.ErrorInfoForm.ShowInTaskbar = false; this.ErrorInfoForm.Text = "错误信息"; this.ErrorInfoForm.Show(this); this.ErrorInfoForm.WriteHtml("<pre>"); // 准备文本输出 } return this.ErrorInfoForm; }
/// <summary> /// 关闭错误信息窗 /// </summary> public void CloseErrorInfoForm() { if (this.m_errorInfoForm != null) { try { this.m_errorInfoForm.Close(); } catch { } this.m_errorInfoForm = null; } }