private void grid_SelectionChanged(object sender, object e) //DataGridSelectionChangedEventArgs e { Abschluse pdfInfo = (Abschluse)(myDataGrid.SelectedItem); Console.WriteLine("Selection Changed : " + pdfInfo); OutputPane.Text = pdfInfo.PdfText; }
private async void searchResult(string srv_url, string index, string type, string srch) { if (srv_url[srv_url.Length - 1] != '/') { srv_url += "/"; } if (!srv_url.StartsWith("http")) { srv_url = "http://" + srv_url; } int totalCnt = 30; int start = 0; try { var settings = new ConnectionConfiguration(new Uri(srv_url + index + "/" + type + "/")) .RequestTimeout(TimeSpan.FromMinutes(2)) .ConnectionLimit(-1); var lowlevelClient = new ElasticLowLevelClient(settings); StringResponse searchResponse; JObject details; while (start < totalCnt) { string requestBody = "{ \"from\":\"" + start.ToString() + "\", \"size\":\"10\", \"query\": { \"match\": { \"PdfText\": \"" + srch + "\"}}}"; start += 10; /*var requestBody = PostData.Serializable( * new * { * from = 0, * size = 30, * query = new * { * match = new * { * PdfText = srch * } * } * }); */ searchResponse = lowlevelClient.Search <StringResponse>(requestBody); Console.WriteLine("Search Finished"); if (searchResponse.Success) { var reponseJson = searchResponse.Body; Console.Write(reponseJson); details = JObject.Parse(reponseJson); totalCnt = (int)details["hits"]["total"]["value"]; for (int i = 0; i < details["hits"]["hits"].Count(); i++) { Abschluse pdf = new Abschluse(); pdf.Id = (int)details["hits"]["hits"][i]["_id"]; pdf.PdfLink = details["hits"]["hits"][i]["_source"]["PdfLink"].ToString(); pdf.PdfText = details["hits"]["hits"][i]["_source"]["PdfText"].ToString(); pdf.DocumentUrl = details["hits"]["hits"][i]["_source"]["DocumentUrl"].ToString(); m_lstPdfInfos.Add(pdf); } } else { /* * var dialog = new MessageDialog(searchResponse.DebugInformation); * await dialog.ShowAsync(); */ } } } catch (Exception e) { var dialog = new MessageDialog(e.Message + "\n" + m_lstPdfInfos.Count.ToString() + " Rows searched"); await dialog.ShowAsync(); Console.WriteLine(e); return; } var dialog1 = new MessageDialog(m_lstPdfInfos.Count.ToString() + " Rows searched"); await dialog1.ShowAsync(); }