private async void btn_start_Click(object sender, EventArgs e) { progressBarAll.Value = 0; gMessage.ResetParametres(); if (gMessage != null) { btn_start.Enabled = false; btn_stop.Enabled = true; thread = new Thread(new ThreadStart(calculate.Run)); thread.Start(); } }
public void Run() { while (true) { try { GRule gRule = null; string[] files = GRule.GetFiles(); for (int i = 0; i < files.Length; i++) { gRule = FileParser.Reads <GRule>(files[i]); callbackProgressBar(0.0); Stack <string> messagesId = null; messagesId = gMessage.GetMessages(GMessage.Query(gRule), ref gRule.lastMesId); //callbackAlert(false); if (messagesId.Count > 0) { foreach (string id in messagesId) { gMessage.GetFile(id, ref gRule, callbackFileName, callbackProgressBar); FileParser.Write(gRule.GetFilePath(), gRule); } } gMessage.ResetParametres(); } } catch (Exception) { //if (MessageBox.Show("Message download error!!!! pidr sykkkkaaaa", "Exception") == DialogResult.OK) { }; /* * if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) * callbackAlert(true); */ } } }