Ejemplo n.º 1
0
        private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
        {
            if (_isScheduleMode)
            {
                bool allDownloaded = true;

                foreach (var thread in _threadsMap)
                {
                    if (ThreadStatuses.GetThreadStatusTypeByStatus(thread.Value.Status) == ThreadStatusType.Failed)
                    {
                        thread.Value.StartThread();
                        allDownloaded = false;
                    }
                }

                if (allDownloaded)
                {
                    _time.Enabled = false;
                    MessageBox.Show(@"Заявки скопированы");
                    MessageBox.Show(@"Все заявки скопированы. Дата/Время:" + DateTime.Now);
                }
            }

            if (_isAutoMode)
            {
                foreach (var thread in _threadsMap)
                {
                    if (ThreadStatuses.GetThreadStatusTypeByStatus(thread.Value.Status) == ThreadStatusType.Failed)
                    {
                        thread.Value.StartThread();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     foreach (var thread in _threadsMap)
     {
         if (ThreadStatuses.GetThreadStatusTypeByStatus(thread.Value.Status) != ThreadStatusType.Failed)
         {
             thread.Value.SetThreadToStop();
         }
     }
 }