/// <summary> /// Method to handle onComplete Event /// </summary> /// <param name="statusCode"> </param> /// <param name="companyFiles"></param> /// <remarks>see http://msdn.microsoft.com/en-us/library/ms171728(v=vs.85).aspx </remarks> private void OnComplete(HttpStatusCode statusCode, CompanyFile[] companyFiles) { //Invoke the SetDataSource method on the UI thread var d = new SetDataSourceCallback(SetDataSource); Invoke(d, new object[] { companyFiles }); }
/// <summary> /// Method called on Async complete /// </summary> /// <param name="statusCode"></param> /// <param name="invoices"></param> /// <remarks></remarks> private void OnComplete(System.Net.HttpStatusCode statusCode, PagedCollection <Invoice> invoices) { //Invoke the SetDataSource method on the UI thread var d = new SetDataSourceCallback(SetDataSource); Invoke(d, new object[] { invoices }); }
private void SetGridSource(DataGridView grid, DataTable oDt) { // Compare the threadID of the calling thread to the threadID of the creating thread. // true if different if (grid.InvokeRequired) { SetDataSourceCallback d = new SetDataSourceCallback(SetGridSource); this.Invoke(d, new object[] { grid, oDt }); } else { grid.DataSource = oDt; } }
public void SetDataSource(DataTable dtMessage) { try { if (this.DgvResult.InvokeRequired) { SetDataSourceCallback d = new SetDataSourceCallback(SetDataSource); this.Invoke(d, new object[] { dtMessage }); } else { DgvResult.DataSource = dtMessage; } } catch (Exception ex) { MessageBox.Show("SetDataSource " + ex.ToString()); } }
private void SetDataSource(List <Model.PNL> outcome, Idea selectedIdea) { List <Model.PNL> x = new List <Model.PNL>(); int cc = 0; foreach (var b in outcome.OrderBy(c => c.Date)) { //x.Add(b); //continue; if (cc >= selectedIdea.TryAfterContinuosError) { cc++; x.Add(b); if (b.Amount > 0) { cc = 0; } } if (b.Amount <= 0) { cc++; } else { cc = 0; } } x = outcome; //if (rgvStocks.DataSource as List<PNL> != null && (rgvStocks.DataSource as List<PNL>).Count() > 0 && outcome.Count > 0) //{ // PNL[] cc2 = new PNL[rgvStocks.Rows.Count]; // (rgvStocks.DataSource as List<PNL>).CopyTo(cc2); // var cc1 = cc2.ToList(); // for (int i = 0; i < cc2.Count(); i++) // { // var d = cc2[i]; // if (outcome.Where(a => a.Stock == d.Stock).Count() == 0) // { // cc1.Remove(d); // } // } // if (cc1.Count > 0) // { // x = cc1; // } // else // { // x = rgvStocks.DataSource as List<PNL>; // } // // outcome = x; //} if (this.rgvStocks.InvokeRequired) { SetDataSourceCallback d = new SetDataSourceCallback(Lund); // this.Invoke(d, new object[] { null, selectedIdea }); this.Invoke(d, new object[] { x, selectedIdea }); } else { this.rgvStocks.DataSource = x; } foreach (var x1 in this.rgvStocks.Rows) { x1.Cells[0].ReadOnly = true; } }
/// <summary> /// Method to handle onComplete Event /// </summary> /// <param name="statusCode"> </param> /// <param name="companyFiles"></param> /// <remarks>see http://msdn.microsoft.com/en-us/library/ms171728(v=vs.85).aspx </remarks> private void OnComplete(HttpStatusCode statusCode, CompanyFile[] companyFiles) { //Invoke the SetDataSource method on the UI thread var d = new SetDataSourceCallback(SetDataSource); Invoke(d, new object[] {companyFiles}); }
/// <summary> /// Method called on Async complete /// </summary> /// <param name="statusCode"></param> /// <param name="invoices"></param> /// <remarks></remarks> private void OnComplete(System.Net.HttpStatusCode statusCode, PagedCollection<Invoice> invoices) { //Invoke the SetDataSource method on the UI thread var d = new SetDataSourceCallback(SetDataSource); Invoke(d, new object[] {invoices}); }