private void BingMapsButton_Click(object sender, RoutedEventArgs e) { string WMSURL = null; if (sender is Button) { Button bt = sender as Button; WMSURL = bt.Tag as string; } SearchingResultPage srp = App.getCurrentSearchingResultPage(); if (srp != null) { srp.addWMSToWMSLayerControlOnBingMaps(WMSURL); } //如果是BingMaps全屏模式 else { SearchingResultPage srp1 = App.getSearchingResultPageFromBingMapsGrid(); if (srp1 != null) { srp1.addWMSToWMSLayerControlOnBingMaps(WMSURL); } } }
void proxy_getWMSLayersQoSHistoricalInfoCompleted(object sender, getWMSLayersQoSHistoricalInfoCompletedEventArgs e) { if (e.Error != null) { } else { LayerQoSInfoForHistory results = e.Result; if (results != null && results.measurementInfoList.Count > 0) { App app = (App)Application.Current; UIElement uiElement = app.RootVisual; if (uiElement is UserControl) { UserControl control = uiElement as UserControl; UIElement root = control.Content; if (root is SearchingResultPage) { SearchingResultPage srp = root as SearchingResultPage; //if user trigger new search during current search stage, current search results will be ignored and this iterative search will be ended. //if not, these search results will be add to current result page if (SearchingResultPage.ID == ID) { if (view != null) { view.serviceQualityInfoPanel.showLayerHistoryInfoOnChart(results); } } } } } } }
void proxy_getServiceQoSHistoricalInfoCompleted(object sender, getServiceQoSHistoricalInfoCompletedEventArgs e) { if (e.Error != null) { } else { ServiceQoSInfoForHistory results = e.Result; //if (results != null) { App app = (App)Application.Current; UIElement uiElement = app.RootVisual; if (uiElement is UserControl) { UserControl control = uiElement as UserControl; UIElement root = control.Content; if (root is SearchingResultPage) { SearchingResultPage srp = root as SearchingResultPage; //if user trigger new search during current search stage, current search results will be ignored and this iterative search will be ended. //if not, these search results will be add to current result page if (SearchingResultPage.ID == ID) { SearchingResultPage.showQoSDetailInformationInControls(results, view); } } } } } }
//获取当前的SearchingResultPage,如果当前页面是SearchingResultPage,否则返回为null public static SearchingResultPage getCurrentSearchingResultPage() { SearchingResultPage srp = null; UserControl root = App.getCurrentPage(); if (root.Content is SearchingResultPage) { srp = root.Content as SearchingResultPage; } return(srp); }
//Iterate to get all the records(each step only get certain number of records) public void proxy_GetRecords_BasicSearchCompleted(object sender, getRecords_BasicSearchCompletedEventArgs e) { if (e.Error != null) { cannotStartSearchYet = false; } else { SearchingResultPage.setSearchButtonEnabled(); CSWGetRecordsSearchResults results = e.Result; iterateGetAllRecords(results); } }
//请求图层信息完成以后,显示在bingmaps,采用级联cascade图层形式 void otherQueryFunctionsServiceClient_getHierachicalLayersOfWMSCompleted(object sender, OtherQueryFunctionsServiceReference.getHierachicalLayersOfWMSCompletedEventArgs e) { if (e.Error != null) { // how to process error } else { if (ID == SearchingResultPage.ID) { SearchingResultPage.addHierachicalLayersToWMSLayer(e.Result); } } }
public void proxy_getRecordsDetailInfoCompleted(object sender, getRecordDetailMetadataCompletedEventArgs e) { if (e.Error != null) { recordsDetail = null; } else { recordsDetail = e.Result; //SearchingResultPage.showMetadataDetailPopupPage(recordsDetail, new Point(SearchingResultPage.pop.MetadataDetailPage.HorizontalOffset, SearchingResultPage.pop.MetadataDetailPage.VerticalOffset)); if (ID == SearchingResultPage.ID) { SearchingResultPage.showMetadataDetailFloatableWindow(recordsDetail); } } }
void proxy_getServerInfoFromURLSCompleted(object sender, getServerInfoFromURLSCompletedEventArgs e) { if (e.Error != null) { //records = null; } else { if (SearchingResultPage.ID == ID) { SearchingResultPage srp = null; ObservableCollection <ClientSideRecord> RecordList = null; App app = (App)Application.Current; UIElement uiElement = app.RootVisual; if (uiElement is UserControl) { UserControl control = uiElement as UserControl; UIElement root = control.Content; if (root is SearchingResultPage) { srp = root as SearchingResultPage; } } if (srp != null) { RecordList = srp.FoundRecords; ObservableCollection <ServerInfo> ServerInfoList = e.Result; foreach (ServerInfo serverInfo in ServerInfoList) { foreach (ClientSideRecord record in RecordList) { if (record.AccessURL.Equals(serverInfo.URL)) { record.URLLocation = serverInfo.LonLat; break; } } } //刷新Bing Maps以更新record的location信息 List <ClientSideRecord> list = srp.getRecordsListInCurrentPage(null); srp.showSpecifiedRecordsInBingMap(list); } } } }
//从全屏的BingMaps对应的Grid中获得与之对应的SearchingResultPage public static SearchingResultPage getSearchingResultPageFromBingMapsGrid() { SearchingResultPage srp1 = null; UIElement content = App.getCurrentPage().Content; if (content != null && content is Grid) { Grid grid = content as Grid; if (grid.Name.Equals("Map_Container")) { Button button = grid.FindName("button_BingMapsFullScreen") as Button; if (button != null) { srp1 = button.Tag as SearchingResultPage; } } } return(srp1); }
void proxy_getServiceQoSSummaryInfoCompleted(object sender, getServiceQoSSummaryInfoCompletedEventArgs e) { if (e.Error != null) { } else { ObservableCollection <ServiceQoSInfoForSummary> results = e.Result; if (results != null && results.Count > 0) { App app = (App)Application.Current; UIElement uiElement = app.RootVisual; if (uiElement is UserControl) { UserControl control = uiElement as UserControl; UIElement root = control.Content; if (root is SearchingResultPage) { SearchingResultPage srp = root as SearchingResultPage; //if user trigger new search during current search stage, current search results will be ignored and this iterative search will be ended. //if not, these search results will be add to current result page if (SearchingResultPage.ID == ID) { foreach (ServiceQoSInfoForSummary performanceInfo in results) { ObservableCollection <ClientSideRecord> list = srp.TabItem_WebServices.DataContext as ObservableCollection <ClientSideRecord>; foreach (ClientSideRecord record in list) //foreach (Record record in srp.searchedRecords) { if (record.RealServiceURL != null && record.RealServiceURL.Equals(performanceInfo.serviceURL)) { record.Quality = performanceInfo.rankValue; break; } } } } } } } } }
private void RecordItemTitle_Click(object sender, RoutedEventArgs e) { TextBlock metadataTitle = (TextBlock)sender; string MetadataAccessURL = (string)metadataTitle.Tag; SearchingResultPage srp = App.getCurrentSearchingResultPage(); if (srp != null) { SearchingResultPage.otherQueryFunction.getRecordDetailMetadata_Using_WCFService(MetadataAccessURL, SearchingResultPage.ID); } //如果是BingMaps全屏模式,则退出全屏 else { SearchingResultPage srp1 = App.getSearchingResultPageFromBingMapsGrid(); if (srp1 != null) { srp1.BingMapsExitFullScreen(); SearchingResultPage.otherQueryFunction.getRecordDetailMetadata_Using_WCFService(MetadataAccessURL, SearchingResultPage.ID); } } }
private void iterateGetAllRecords(CSWGetRecordsSearchResults results) { if (results == null) { return; } // if current searched records num equal or larger than expect, then stop current search and do not add records into result list any more. if (currentGotRecordsNumber >= maxRecordsExpectToGet) { return; } TimeSpan tspan = DateTime.Now.Subtract(time_BeforeSearch); double time1 = tspan.TotalMilliseconds; double responseTime = time1 / 1000; allSearchTimeFromFirstRequest.Add(responseTime); int numberOfRecordsMatchedInCurrentCatalog = results.numberOfRecordsMatched; string catalogURL = results.MetadataRepositoryURL; CatalogsSearchStatus currentCatalogStatus = null; foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList) { if (catalogsSearchStatus.CatalogURL.Equals(catalogURL)) { currentCatalogStatus = catalogsSearchStatus; } } if (!currentCatalogStatus.hasGotTotalMatchedNumber) { allMatchedRecordsNumberInSearchedCatalogs += results.numberOfRecordsMatched; currentCatalogStatus.matchedNumber = results.numberOfRecordsMatched; currentCatalogStatus.hasGotTotalMatchedNumber = true; } ObservableCollection <Record> records = null; records = results.recordList; bool continueSearching = false; string seachingStatus = ConstantCollection.searchStatus_InProcessing; //foreach (Record record in records) //{ // StringList a = new StringList(); // a.AddRange(record.SBAs); // record.SBAListObject = a; //} if (ConstantCollection.isQueryServicePerformanceScore && (!ConstantCollection.queryServicePerformanceScoreAtServerSide)) { if (records != null && records.Count > 0) { queryPerformanceFunctions.getGeospatialServiceQoSSummaryInfo(records); } } if (ConstantCollection.isQueryServerLocationLonLat && (!ConstantCollection.queryServerLocationLonLatAtServerSide)) { if (records != null && records.Count > 0) { ObservableCollection <string> URLList = new ObservableCollection <string>(); foreach (Record record in records) { //currently, we only query the server information of OGC web services if (record.Type.Equals(ConstantCollection.ServiceType_CSW) || record.Type.Equals(ConstantCollection.ServiceType_WMS) || record.Type.Equals(ConstantCollection.ServiceType_WCS) || record.Type.Equals(ConstantCollection.ServiceType_WPS) || record.Type.Equals(ConstantCollection.ServiceType_WFS)) { if (record.URLLocation == null || record.URLLocation.Trim().Equals("")) { URLList.Add(record.AccessURL); } } } if (URLList.Count > 0) { otherQueryFuntions.getServerInformationFromURLS(URLList, ID); } } } int local_potentialNumber = currentGotRecordsNumber + results.numberOfRecordsReturned; int potentialNumber = local_potentialNumber; foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList) { if (catalogsSearchStatus.isTerminated == false && catalogsSearchStatus.potentioalRetrieveNumber > 0) { potentialNumber += catalogsSearchStatus.potentioalRetrieveNumber; } } int nextRecordInCurrentCatalog = results.nextRecord; if (nextRecordInCurrentCatalog == 0 || nextRecordInCurrentCatalog > numberOfRecordsMatchedInCurrentCatalog) { nextRecordInCurrentCatalog = numberOfRecordsMatchedInCurrentCatalog; } currentCatalogStatus.nextRecord = nextRecordInCurrentCatalog; //if potentialNumber less than maxRecordsWantToResult, and nextRecordInCurrentCatalog less then numberOfRecordsMatchedInCurrentCatalog, then continue search if (potentialNumber < maxRecordsExpectToGet && nextRecordInCurrentCatalog < numberOfRecordsMatchedInCurrentCatalog) { continueSearching = true; seachingStatus = ConstantCollection.searchStatus_InProcessing; //User can start a new search now, no needs to want all the records of current are queried. cannotStartSearchYet = false; } else { cannotStartSearchYet = false; continueSearching = false; //if local potentialNumber greater than maxRecordsWantToResult, then change status if (local_potentialNumber >= maxRecordsExpectToGet) { seachingStatus = ConstantCollection.searchStatus_Finished; isAllSearchTerminated = true; } else if (nextRecordInCurrentCatalog >= numberOfRecordsMatchedInCurrentCatalog) { currentCatalogStatus.isTerminated = true; bool allFinished = true; foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList) { if (catalogsSearchStatus.isTerminated == false) { allFinished = false; } } if (allFinished) { seachingStatus = ConstantCollection.searchStatus_Finished; isAllSearchTerminated = true; } else { seachingStatus = ConstantCollection.searchStatus_InProcessing; } } } //if zero record is responsed and the search status is abnormal, then set the search status to show the problems. if (results.numberOfRecordsMatched == 0 && results.numberOfRecordsReturned == 0 && results.SearchStatus != null) { seachingStatus = results.SearchStatus; //if response error also means this catalog's search is over currentCatalogStatus.isTerminated = true; currentCatalogStatus.isFailed = true; bool allFinished = true; bool allFailed = true; foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList) { if (catalogsSearchStatus.isTerminated == false) { allFinished = false; } if (catalogsSearchStatus.isFailed == false) { allFailed = false; } } if (allFinished) { isAllSearchTerminated = true; if (!allFailed) { seachingStatus = ConstantCollection.searchStatus_Finished; } } } //if currentSearchedNum less than maxRecordsWantToResult and numOfRecords, continue search if (continueSearching) { int requestRecordsNumber = ConstantCollection.eachInvokeSearchNum_ExceptFirstTime; if (potentialNumber < maxRecordsExpectToGet) { //if (maxRecordsExpectToGet - potentialNumber) < retrieve interval, set retrieve interval to that value int num = maxRecordsExpectToGet - potentialNumber; if (num < requestRecordsNumber) { requestRecordsNumber = num; } } //if number of rest matched records is less then retrieve interval, just set current retrieve interval to the rest number int num1 = currentCatalogStatus.matchedNumber - results.nextRecord + 1; if (num1 > 0 && num1 < requestRecordsNumber) { requestRecordsNumber = num1; } int nextRecord = results.nextRecord; if (searchingContentObject != null) { cswQueryServiceClient.getRecords_AdvancedSearchAsync(searchingContentObject, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance); } else if (vocabularyObject != null) { cswQueryServiceClient.getRecords_QuickSearchBySBAAsync(vocabularyObject, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance); } else { cswQueryServiceClient.getRecords_BasicSearchAsync(contentToSearching, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance); } currentCatalogStatus.potentioalRetrieveNumber = requestRecordsNumber; } SearchingResultPage currentResultPage = null; if (isFirstInvokeToSearch) { currentGotRecordsNumber = results.numberOfRecordsReturned; SearchingResultPage.showSearchingResultPage(contentToSearching, currentGotRecordsNumber, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus, records, sortingRule, isResult_CategorizedInTabItems); isFirstInvokeToSearch = false; } else { App app = (App)Application.Current; UIElement uiElement = app.RootVisual; if (uiElement is UserControl) { UserControl control = uiElement as UserControl; UIElement root = control.Content; if (root is SearchingResultPage) { currentResultPage = root as SearchingResultPage; //if user trigger new search during current search stage, current search results will be ignored and this iterative search will be ended. //if not, these search results will be add to current result page if (SearchingResultPage.ID == ID) { int newAddNum = results.numberOfRecordsReturned; bool willOverflow = false; if (currentGotRecordsNumber + newAddNum > maxRecordsExpectToGet) { newAddNum = maxRecordsExpectToGet - currentGotRecordsNumber; willOverflow = true; } int numAfterAddOperation = newAddNum + currentGotRecordsNumber; currentResultPage.setSearchStutusBarInformation(numAfterAddOperation, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus); if (!willOverflow) { if (currentResultPage.noRecord == true) { currentResultPage.setResultPageContents(contentToSearching, numAfterAddOperation, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus, records, sortingRule); } else { if (records != null) { foreach (Record record in records) { ClientSideRecord newRecord = ClientSideRecord.cloneRecord(record); currentResultPage.insertRecordsIntoResultPage(newRecord, sortingRule); } } currentResultPage.setRecordCountTextBlockValue(); } } else { int i = 0; foreach (Record record in records) { if (i++ < newAddNum) { ClientSideRecord newRecord = ClientSideRecord.cloneRecord(record); currentResultPage.insertRecordsIntoResultPage(newRecord, sortingRule); } } currentResultPage.setRecordCountTextBlockValue(); } currentGotRecordsNumber = numAfterAddOperation; } else { return; } } } currentCatalogStatus.potentioalRetrieveNumber = 0; } if (isAllSearchTerminated) { if (currentResultPage != null) { currentResultPage.SearchSummaryViewer.Visibility = Visibility.Visible; } } }