private void button2_Click(object sender, EventArgs e) { _asyncService.PerformAsyncAction( () => { Thread.Sleep(1000); return(true); }, flag => label1.Text = "1" ); }
private void button1_Click(object sender, EventArgs e) { var col1 = _companyDataService.GetData().Take(100); _messageBoxService.ShowMessage( col1.First().GetHashCode().ToString() ); _messageBoxService.ShowMessage( col1.First().GetHashCode().ToString() ); var col2 = _companyDataService.GetData().Take(100).ToList(); _messageBoxService.ShowMessage( col2.First().GetHashCode().ToString() ); _messageBoxService.ShowMessage( col2.First().GetHashCode().ToString() ); _asyncService.PerformAsyncAction( () => { _data = _companyDataService.GetData().Take(100).ToList(); return(_data); }, data => dataGridView1.DataSource = data ); }