private void BuyItemsFromGlobalTrade()
        {
            waitForNewImages();

            PanelLocation desirableItem = ScanGlobalForDesiredItems();

            // refresh if no desired item
            if (desirableItem == null && this.tradeWindow.IsRefreshGlobalTradeButtonVisible())
            {
                touch.ClickAt(Bot.Location.GlobalTradeRefresh);
                WaitForSeconds(1);
                waitForNewImages();
                desirableItem = ScanGlobalForDesiredItems();
            }

            if (desirableItem != null)
            {
                var clickPoint = this.tradeWindow.CalcClickPointGlobalTrade(desirableItem);
                touch.ClickAt(clickPoint);
            }
            else
            {
                // click random panel
                var globalPanels = itemHashes.ProcessCaptureImages(tradePanelCapture.CaptureImagesGlobalTrade());
                if (globalPanels.Count > 0)
                {
                    var clickPoint = this.tradeWindow.CalcClickPointGlobalTrade(globalPanels[random.Next(globalPanels.Count())]);
                    touch.ClickAt(clickPoint);
                }
            }
            WaitForSeconds(1);

            // wait for items to appear
            WaitFor(this.tradeWindow.IsTradeDepotLogoVisible, "Trade Logo");
            WaitForSeconds(1);
            SleepUntilTradeDepotItemsAreVisible(30);
            var panels = itemHashes.ProcessCaptureImages(tradePanelCapture.CaptureImagesTradeDepot());

            BuyTradeDepotItems(panels);

            if (panels.Count() > 7)
            {
                // swipe
                touch.Swipe(Bot.Location.GlobalTradeMiddleRight, Bot.Location.GlobalTradeMiddleRight, Bot.Location.GlobalTradeMiddleLeft, swipeSteps, true);
                WaitForSeconds(1);
                panels = itemHashes.ProcessCaptureImages(tradePanelCapture.CaptureImagesTradeDepot());
                BuyTradeDepotItems(panels);
            }

            if (panels.Count() > 7)
            {
                touch.Swipe(Bot.Location.GlobalTradeMiddleRight, Bot.Location.GlobalTradeMiddleRight, Bot.Location.GlobalTradeMiddleLeft, swipeSteps, true);
                WaitForSeconds(1);
                panels = itemHashes.ProcessCaptureImages(tradePanelCapture.CaptureImagesTradeDepot());
                BuyTradeDepotItems(panels);
            }

            // Click home button
            WaitForSeconds(1);

            int nn = 0;

            while (this.tradeWindow.IsTradeDepotLogoVisible())
            {
                nn++;
                touch.ClickAt(Bot.Location.GlobalTradeOtherCity);
                if (nn == 60)
                {
                    touch.ClickAt(Bot.Location.GlobalTradeOk);
                    nn = 0;
                }
            }
            touch.ClickAt(Bot.Location.GlobalTradeOtherCity);

            if (this.tradeWindow.IsOfflineButtonVisible())
            {
                // close it
                touch.ClickAt(Bot.Location.GlobalTradeOk);
            }

            WaitForSeconds(2);

            if (tradePanelCapture.CaptureImagesGlobalTrade().Count == 0)
            {
                touch.ClickAt(Bot.Location.HomeButton);
            }
        }