void MessageHub_SearchResponseEvent(object sender, SearchResponseEventArgs e) { if (e.TaskID != _searchParam._searchID) return; if (e.ResultCount == -1 && e.Start == -1) { // 检索过程结束 _searchParam._searchComplete = true; _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); return; } string strError = ""; if (e.ResultCount == -1) { strError = e.ErrorInfo; goto ERROR1; } List<string> array = StringUtil.ParseTwoPart(e.LibraryUID, "|"); string strLibraryName = array[0]; // 标记结束一个检索目标 // return: // 0 尚未结束 // 1 结束 // 2 全部结束 int nRet = _searchParam._manager.CompleteTarget(e.LibraryUID, e.ResultCount, e.Records == null ? 0 : e.Records.Count); _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); if (nRet == 2) _searchParam._searchComplete = true; // 单独给一个线程来执行 Task.Factory.StartNew(() => FillList(e.Start, strLibraryName, e.Records)); return; #if NO // TODO: 注意来自共享网络的图书馆名不能和 servers.xml 中的名字冲突。另外需要检查,不同的 UID,图书馆名字不能相同,如果发生冲突,则需要给分配 ..1 ..2 这样的编号以示区别 // 需要一直保存一个 UID 到图书馆命的对照表在内存备用 // TODO: 来自共享网络的记录,图标或 @ 后面的名字应该有明显的形态区别 foreach (DigitalPlatform.MessageClient.Record record in e.Records) { MessageHub.DecodeRecord(record, _searchParam._serverPushEncoding); string strXml = record.Data; string strMarcSyntax = ""; string strBrowseText = ""; string strColumnTitles = ""; int nRet = BuildBrowseText(strXml, out strBrowseText, out strMarcSyntax, out strColumnTitles, out strError); if (nRet == -1) goto ERROR1; // string strRecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false ? record.LibraryName : record.LibraryUID); string strRecPath = record.RecPath; #if NO string strDbName = ListViewProperty.GetDbName(strRecPath); _browseTitleTable[strDbName] = strColumnTitles; #endif _browseTitleTable[strMarcSyntax] = strColumnTitles; // 将书目记录放入 m_biblioTable { BiblioInfo info = new BiblioInfo(); info.OldXml = strXml; info.RecPath = strRecPath; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); info.Format = strMarcSyntax; this.browseWindow.BiblioTable[strRecPath] = info; } List<string> column_list = StringUtil.SplitList(strBrowseText, '\t'); string[] cols = new string[column_list.Count]; column_list.CopyTo(cols); ListViewItem item = null; this.Invoke((Action)(() => { item = Global.AppendNewLine( this.browseWindow.RecordsList, strRecPath, cols); } )); if (item != null) item.BackColor = Color.LightGreen; #if NO RegisterBiblioInfo info = new RegisterBiblioInfo(); info.OldXml = strXml; // strMARC; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); info.RecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false ? record.LibraryName : record.LibraryUID); info.MarcSyntax = strMarcSyntax; #endif _searchParam._searchCount++; } return; #endif ERROR1: // 加入一个文本行 AddErrorLine(strError); }
void MessageHub_SearchResponseEvent(object sender, SearchResponseEventArgs e) { if (e.SsearchID != _searchParam._searchID) return; if (e.ResultCount == -1 && e.Start == -1) { // 检索过程结束 _searchParam._searchComplete = true; return; } string strError = ""; if (e.ResultCount == -1) { strError = e.ErrorInfo; goto ERROR1; } // TODO: 注意来自共享网络的图书馆名不能和 servers.xml 中的名字冲突。另外需要检查,不同的 UID,图书馆名字不能相同,如果发生冲突,则需要给分配 ..1 ..2 这样的编号以示区别 // 需要一直保存一个 UID 到图书馆命的对照表在内存备用 // TODO: 来自共享网络的记录,图标或 @ 后面的名字应该有明显的形态区别 foreach(BiblioRecord record in e.Records) { string strXml = record.Data; string strMarcSyntax = ""; string strBrowseText = ""; string strColumnTitles = ""; int nRet = BuildBrowseText(strXml, out strBrowseText, out strMarcSyntax, out strColumnTitles, out strError); if (nRet == -1) goto ERROR1; int image_index = -1; image_index = TYPE_CLOUD; RegisterBiblioInfo info = new RegisterBiblioInfo(); info.OldXml = strXml; // strMARC; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); info.RecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false? record.LibraryName : record.LibraryUID); info.MarcSyntax = strMarcSyntax; AddBiblioBrowseLine( image_index, // -1, info.RecPath, strBrowseText, info, _searchParam._autoSetFocus); _searchParam._searchCount++; } return; ERROR1: // 加入一个文本行 AddBiblioBrowseLine( TYPE_ERROR, "", // item.RecPath, strError, null, false); }
void MessageHub_SearchResponseEvent(object sender, SearchResponseEventArgs e) { if (e.SsearchID != _searchParam._searchID) return; if (e.ResultCount == -1 && e.Start == -1) { // 检索过程结束 _searchParam._searchComplete = true; return; } string strError = ""; if (e.ResultCount == -1) { strError = e.ErrorInfo; goto ERROR1; } // TODO: 注意来自共享网络的图书馆名不能和 servers.xml 中的名字冲突。另外需要检查,不同的 UID,图书馆名字不能相同,如果发生冲突,则需要给分配 ..1 ..2 这样的编号以示区别 // 需要一直保存一个 UID 到图书馆命的对照表在内存备用 // TODO: 来自共享网络的记录,图标或 @ 后面的名字应该有明显的形态区别 foreach (BiblioRecord record in e.Records) { string strXml = record.Data; string strMarcSyntax = ""; string strBrowseText = ""; string strColumnTitles = ""; int nRet = BuildBrowseText(strXml, out strBrowseText, out strMarcSyntax, out strColumnTitles, out strError); if (nRet == -1) goto ERROR1; string strRecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false ? record.LibraryName : record.LibraryUID); #if NO string strDbName = ListViewProperty.GetDbName(strRecPath); _browseTitleTable[strDbName] = strColumnTitles; #endif _browseTitleTable[strMarcSyntax] = strColumnTitles; // 将书目记录放入 m_biblioTable { BiblioInfo info = new BiblioInfo(); info.OldXml = strXml; info.RecPath = strRecPath; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); info.Format = strMarcSyntax; this.m_biblioTable[strRecPath] = info; } List<string> column_list = StringUtil.SplitList(strBrowseText, '\t'); string[] cols = new string[column_list.Count]; column_list.CopyTo(cols); ListViewItem item = null; this.Invoke((Action)(() => { item = Global.AppendNewLine( this.listView_records, strRecPath, cols); } )); if (item != null) item.BackColor = Color.LightGreen; #if NO RegisterBiblioInfo info = new RegisterBiblioInfo(); info.OldXml = strXml; // strMARC; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); info.RecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false ? record.LibraryName : record.LibraryUID); info.MarcSyntax = strMarcSyntax; #endif _searchParam._searchCount++; } return; ERROR1: // 加入一个文本行 { string[] cols = new string[1]; cols[0] = strError; this.Invoke((Action)(() => { ListViewItem item = Global.AppendNewLine( this.listView_records, "error", cols); } )); } }
void MessageHub_SearchResponseEvent(object sender, SearchResponseEventArgs e) { if (e.TaskID != _searchParam._searchID) return; if (e.ResultCount == -1 && e.Start == -1) { // 检索过程结束 _searchParam._searchComplete = true; _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); return; } string strError = ""; // _searchParam.SetLibraryNameTable("@" + e.LibraryUID); List<string> array = StringUtil.ParseTwoPart(e.LibraryUID, "|"); string strLibraryName = array[0]; // 标记结束一个检索目标 // return: // 0 尚未结束 // 1 结束 // 2 全部结束 int nRet = _searchParam._manager.CompleteTarget(e.LibraryUID, e.ResultCount, e.Records == null ? 0 : e.Records.Count); _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); if (nRet == 2) _searchParam._searchComplete = true; if (e.ResultCount == -1) { strError = e.ErrorInfo; goto ERROR1; } #if NO if (e.Records != null) _searchParam._searchCount += e.Records.Count; #endif // 单独给一个线程来执行 Task.Factory.StartNew(() => FillList(e.Start, strLibraryName, e.Records)); return; ERROR1: AddErrorLine(strError); }
void MessageHub_SearchResponseEvent(object sender, SearchResponseEventArgs e) { if (e.TaskID != _searchParam._searchID) return; if (e.ResultCount == -1 && e.Start == -1) { // 检索过程结束 _searchParam._searchComplete = true; _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); return; } string strError = ""; if (e.ResultCount == -1) { strError = e.ErrorInfo; goto ERROR1; } List<string> array = StringUtil.ParseTwoPart(e.LibraryUID, "|"); string strLibraryName = array[0]; // 标记结束一个检索目标 // return: // 0 尚未结束 // 1 结束 // 2 全部结束 int nRet = _searchParam._manager.CompleteTarget(e.LibraryUID, e.ResultCount, e.Records == null ? 0 : e.Records.Count); _searchParam._searchCount = (int)_searchParam._manager.GetTotalCount(); if (nRet == 2) _searchParam._searchComplete = true; // 单独给一个线程来执行 Task.Factory.StartNew(() => FillList(e.Start, strLibraryName, e.Records)); #if NO // TODO: 注意来自共享网络的图书馆名不能和 servers.xml 中的名字冲突。另外需要检查,不同的 UID,图书馆名字不能相同,如果发生冲突,则需要给分配 ..1 ..2 这样的编号以示区别 // 需要一直保存一个 UID 到图书馆命的对照表在内存备用 // TODO: 来自共享网络的记录,图标或 @ 后面的名字应该有明显的形态区别 foreach (DigitalPlatform.MessageClient.Record record in e.Records) { MessageHub.DecodeRecord(record, _searchParam._serverPushEncoding); string strXml = record.Data; string strMarcSyntax = ""; string strBrowseText = ""; string strColumnTitles = ""; int nRet = BuildBrowseText(strXml, out strBrowseText, out strMarcSyntax, out strColumnTitles, out strError); if (nRet == -1) goto ERROR1; int image_index = -1; image_index = TYPE_CLOUD; RegisterBiblioInfo info = new RegisterBiblioInfo(); info.OldXml = strXml; // strMARC; info.Timestamp = ByteArray.GetTimeStampByteArray(record.Timestamp); // info.RecPath = record.RecPath + "@" + (string.IsNullOrEmpty(record.LibraryName) == false ? record.LibraryName : record.LibraryUID); info.RecPath = record.RecPath; info.MarcSyntax = strMarcSyntax; AddBiblioBrowseLine( image_index, // -1, info.RecPath, strBrowseText, info, _searchParam._autoSetFocus); _searchParam._searchCount++; } #endif return; ERROR1: // 加入一个文本行 AddBiblioBrowseLine( TYPE_ERROR, "", // item.RecPath, strError, null, false); }