private void ThreadRun()
{
GuildWars2Status = Notifier.GuildWars2Status.Loading;
LoadItems();
LoadRecipes();
TradingPostApiOfficial.Initialize();
GuildWars2Status = Notifier.GuildWars2Status.FinishedLoading;
//LoadRavenDB();
//String uriTrendSell = CurrendTrendApi.UriTrendSell();
//ScrapeHelper.Get(uriTrendSell, "", null, "", TrendActionSell, "");
//String uriTrendBuy = CurrendTrendApi.UriTrendBuy();
//ScrapeHelper.Get(uriTrendBuy, "", null, "", TrendActionBuy, "");
try
{
while (IsRunning)
{
//while (IsSearchInProgress)
//{
// Thread.Sleep(10);
//}
for (int i = 0; i < Queue.Count; i++)
{
HotItem item = Queue[i];
Task.Factory.StartNew(() =>
{
item.BuildItem(ForceItemBuild); // It checks that the item gets build only once
item.UpdatePrices();
item.CompareToRules();
});
//ItemStore.Store(Queue);
Thread.Sleep(100);
}
try
{
var items = new List<HotItem>(RecipeItemPool.Values);
foreach (var item in RecipeItemPool)
{
UpdateItemDetails(item.Value);
item.Value.BuildItem(false);
}
UpdatePricesMultiple(items);
}
catch
{
// Changed the collection
}
try
{
Gem.Update();
}
catch
{
}
ForceItemBuild = false;
Thread.Sleep(5000);
}
}
catch (ThreadInterruptedException)
{
IsRunning = false;
}
}