Пример #1
0
        internal void StartToDownload(List <int> indexes)
        {
            List <string> cadNums = new List <string>();

            foreach (int i in indexes)
            {
                MyXmlNode node       = AllDataBase[i].node;
                bool      started    = node.started;
                bool      downloaded = node.downloaded;
                if (started && !downloaded)
                {
                    node.started    = true;
                    node.finished   = false;
                    node.curStatus  = -1;
                    node.downloaded = true;
                    cadNums.Add(ClassCalcConnect.GetChangeNumbStr(node.number));
                }
            }
            if (cadNums.Count == 0)
            {
                return;
            }
            if (!downloadedStarted)
            {
                System.Threading.Thread thr = new System.Threading.Thread(() => onSendNumsDownLoad(cadNums));
                thr.Start();
            }
            else
            {
                CppClass.DownloadFilesFromServer(cadNums.ToArray());
                System.Threading.Thread thr = new System.Threading.Thread(p => updateDownloadRows());
                thr.Start();
            }
        }
Пример #2
0
        private void onSendNumsDownLoad(List <string> cadNums)
        {
            downloadedStarted = true;
            CppClass.DownloadFilesFromServer(cadNums.ToArray());

            System.Threading.Thread thr = new System.Threading.Thread(p => updateDownloadRows());
            thr.Start();

            aTimerDownload         = new System.Timers.Timer(DownloadUpdateInterval);
            aTimerDownload.Enabled = true;
            //    aTimer.Elapsed += new ElapsedEventHandler(delegate(object sender, ElapsedEventArgs e) { GetStatus(); });
            //  aTimer.Elapsed += new ElapsedEventHandler((object sender, ElapsedEventArgs e)=> GetStatus());
            aTimerDownload.Elapsed += new ElapsedEventHandler((p, c) => updateDownloadRows());
            aTimerDownload.Start();
            // Thread.Sleep(10000);

            //throw new NotImplementedException();
        }