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(); } }
private void GetStatus() { if (timerWork) { } else { Dictionary <string, DataBase> sendedList = new Dictionary <string, DataBase>(); timerWork = true; foreach (DataBase nodeBase in AllDataBase) { MyXmlNode node = nodeBase.node; bool started = node.started; bool finished = node.finished; bool downloaded = node.downloaded; string number = node.number; if (started && !finished && !downloaded) { sendedList.Add(ClassCalcConnect.GetChangeNumbStr(number), nodeBase); } } if (sendedList.Count > 0) { int[] status = CppClass.GetStatusFiles(sendedList.Keys.ToArray()); for (int i = 0; i < sendedList.Count; i++) { var item = sendedList.ElementAt(i); item.Value.node.curStatus = status[i]; updateRowByStatus(item.Value); } } timerWork = false; } }
internal void StartToSend(List <int> indexes) { List <string> cadNums = new List <string>(); foreach (int i in indexes) { MyXmlNode node = AllDataBase[i].node; bool downloaded = node.downloaded; if (!downloaded) { cadNums.Add(ClassCalcConnect.GetChangeNumbStr(node.number)); node.started = true; node.finished = false; node.downloaded = false; node.curStatus = -1; } } System.Threading.Thread thr = new System.Threading.Thread(() => onSendNums(cadNums)); thr.Start(); }