public void SetBookInfo(BookInfo bookInfo, Sprite sprite) { title.text = bookInfo.Title + "\n" + bookInfo.Author + ", " + bookInfo.GetData("pub_date"); itemImage.sprite = sprite; isFlashing = true; flashUITimer.Reset(); }
/*get data from internet*/ public ObservableCollection <Book> GetInformation(string pKeyword, bool pIsISBN) { //try //{ XmlDocument xdoc; if (pIsISBN) { xdoc = bookinfo.GetData(false, false, pKeyword, ""); } else { xdoc = bookinfo.GetData(false, false, "", pKeyword); } XDocument xBookInfo; xBookInfo = XDocument.Load(new XmlNodeReader(xdoc)); XNamespace ns = "http://webservices.amazon.com/AWSECommerceService/2011-04-01"; var items = from item in xBookInfo.Descendants(ns + "Item") from detail in item.Descendants(ns + "ItemAttributes") select new Book() { Authors = GetInternetAuthor(detail.Element(ns + "Author").Value), bok_Title = detail.Element(ns + "Title").Value, Publisher = GetInternetPulisher(detail.Element(ns + "Manufacturer").Value), bok_ISBN = item.Element(ns + "ASIN").Value }; foreach (Book b in items) { _books.Add(b); //return b; } return(_books); //} //catch { //} }
// set this in Whirlwind.cs public void SetBookInfo(BookInfo bookInfo, Sprite sprite) { currentBookInfo = bookInfo; string[] columns = {"title", "title_subtitle", "name", "pub_date", "pub_place", "note", "scope_content", "history"}; string text = ""; for (int i = 0; i < columns.Length; i++) { string s = bookInfo.GetData(columns[i]); if (s.Length > 1) { text += s + "\n\n"; } } transform.Find("Fields").GetComponent<ScrollRect>().verticalNormalizedPosition = 1f; fields.text = text; }
// search by single bookinfo, this is for enlarge view public List<WhirlwindBeltInfo> Search(BookInfo inputInfo, int numBelts) { Debug.Assert(inputInfo != null); if (connectionSuccess) { List<WhirlwindBeltInfo> retVal = new List<WhirlwindBeltInfo>(); List<BookInfo> b; WhirlwindBeltInfo wwbi; // search through the columns for (int i = 0; i < columns.Length; i++) { // make a query if (columns[i].Equals("subject")) { b = connector.SearchBySubject(inputInfo.GetSubjects()); } else { b = connector.Search(inputInfo.GetData(columns[i]), columns[i]); } // remove ones that are the same as the search term itself for (int j = 0; j < b.Count; j++) { if (b[j].FileName.Equals(inputInfo.FileName)) { b.Remove(b[j]); break; } } // limits the items count b = b.GetRange(0, Mathf.Min(b.Count, maxItemsPerBelt)); wwbi = new WhirlwindBeltInfo(b, columnTitles[i]); retVal.Add(wwbi); } // sort the search results by popularity retVal.Sort(delegate(WhirlwindBeltInfo b1, WhirlwindBeltInfo b2) { return b2.InfosCount.CompareTo(b1.InfosCount); }); // return the top N results (pad if necessary) retVal = retVal.GetRange(0, numBelts); return retVal; } else { return OfflinePlaceHolderSearch(numBelts); } }