private void Worker_DoWork(object sender, DoWorkEventArgs e) { try { Cbr reader = new Cbr(selectedDateTeme); reader.Start(); MessageBox.Show("Загрузка данных завершена", "Загрузка", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void MyTimer_Elapsed(object sender, ElapsedEventArgs e) { try { cbr.Start(); } catch (Exception ex) { if (!File.Exists(@"C:\log.txt")) { File.Create(@"C:\log.txt"); } WriteLogMessage(ex.ToString()); } }