コード例 #1
0
ファイル: Cancel.cs プロジェクト: ricardochaves/MasterControl
 private static void AuctionHouse_SearchDone(SearchDoneArgs ca)
 {
     var cheapest = ca.Auctions.OrderBy(a => a.BuyoutPricePerItem.TotalCopper).FirstOrDefault();
     if (cheapest != null && !CancelDict.ContainsKey(cheapest.Id))
     {
         CancelDict.Add(cheapest.Id, cheapest);
     }
     AuctionHouse.SearchDone -= AuctionHouse_SearchDone;
     Logging.Write("Still need to scan {0} items.", CancelCheckQueue.Count);
     if (CancelCheckQueue.Count > 0)
     {
         var itemToScan = CancelCheckQueue.Dequeue();
         while (CancelDict.ContainsKey(itemToScan))
         {
             if (CancelCheckQueue.Count > 0)
                 itemToScan = CancelCheckQueue.Dequeue();
             else
             {
                 CancelTheQueue();
                 return;
             }
         }
         StartSearch(itemToScan);
     }
     else
     {
         CancelTheQueue();
     }
 }
コード例 #2
0
 private static void AuctionItemsListUpdatedSearch()
 {
     _auctionsCount = Lua.GetReturnVal<int>("return GetNumAuctionItems(\"list\")", 1);
     Logging.Write("Showing results {0}-{1}, there is {2} results", _page*50, (_page+1)*50, _auctionsCount);
     _auctions.AddRange(GetCurrentPage());
     _page++;
     if (_page*50 < _auctionsCount)
     {
         Logging.Write("Searching next page");
         SearchNextPage();
     }
     else
     {
         var results = new SearchDoneArgs(_auctions, _searchString, _searchId);
         Logging.Write("Search has completed for {0}", _searchString);
         if(SearchDone != null)
             SearchDone(results);
         //Lua.Events.DetachEvent("AUCTION_ITEM_LIST_UPDATE", AuctionItemsListUpdatedSearch);
     }
 }