コード例 #1
0
 public void StartThreads()
 {
     foreach (UpdatedFile currFile in m_Files)
     {
         ThreadWithParam threadParam = new ThreadWithParam();
         threadParam.Function  = FileUpdaterThread;
         threadParam.Parameter = currFile;
         Thread newThread = threadParam.CreateThread();
         newThread.IsBackground = true;
         newThread.Start();
         m_Threads.Add(newThread);
     }
 }
コード例 #2
0
ファイル: MarketPricesDB.cs プロジェクト: Blessvk/EveRefinery
        private void                            TestMarketPrices(IPriceProvider a_PriceProvider, Settings.V2._PriceSettings a_Settings, bool a_Silent)
        {
            ItemFilter filter = new ItemFilter();

            filter.HasMarketGroup  = TristateFilter.Yes;
            filter.IsPricesOk      = TristateFilter.No;
            filter.PriceExpiryDays = a_Settings.ExpiryDays;

            UInt32[] badItems = m_ItemsDB.FilterItems(filter);
            if (0 == badItems.Count())
            {
                return;
            }

            if (!a_Silent)
            {
                if (DialogResult.Yes != MessageBox.Show("You have outdated market prices. Would you like to update them now?", Application.ProductName, MessageBoxButtons.YesNo))
                {
                    return;
                }
            }

            Queue <UInt32> pricesQueue = new Queue <UInt32>();

            foreach (UInt32 currItem in badItems)
            {
                pricesQueue.Enqueue(currItem);
            }

            StopUpdaterThread();

            UpdateThreadParam param = new UpdateThreadParam();

            param.PriceProvider = a_PriceProvider;
            param.UpdateQueue   = pricesQueue;

            ThreadWithParam paramThread = new ThreadWithParam();

            paramThread.Function  = ThreadQueryMarketPrices;
            paramThread.Parameter = param;

            m_EndUpdateThread = false;
            m_UpdateQueue     = pricesQueue;

            m_UpdateThread = paramThread.CreateThread();
            m_UpdateThread.IsBackground = true;
            m_UpdateThread.Start();
        }