/// <summary> /// Method to get bitmap /// </summary> /// <param name="index"></param> /// <returns></returns> private GetImageBitmapArgs GetImageBitmap(CellInfo ci, DataRowMx dr, int listSourceRowIndex, object fieldValue, ImageMx imageMx, int callId) { DateTime t0 = DateTime.Now; QueryManager qm = Grid.QueryManager; ResultsFormatter fmtr = qm.ResultsFormatter; FormattedFieldInfo ffi = fmtr.FormatField(ci.Rt, ci.TableIndex, ci.Rfld, ci.FieldIndex, dr, listSourceRowIndex, fieldValue, ci.DataRowIndex, false); if (ffi.FormattedBitmap == null) { ffi.FormattedBitmap = new Bitmap(1, 1); } imageMx.FormattedBitmap = ffi.FormattedBitmap; // store ref to bitmap imageMx.Value = imageMx.FormattedBitmap; // value is also the bitmap imageMx.IsRetrievingValue = false; // retrieve is complete StoreFormattingInformationInMdt(ffi, fieldValue, dr, ci, imageMx); //if (Debug) ClientLog.Message("GetImageBitmap complete for callId: " + callId + ", Time(ms) = " + TimeOfDay.Delta(t0)); GetImageBitmapArgs a = new GetImageBitmapArgs(); a.ci = ci; a.dr = dr; a.listSourceRowIndex = listSourceRowIndex; a.fieldValue = fieldValue; a.imageMx = imageMx; a.callId = callId; return(a); }
/// <summary> /// Callback after image is retrieved refreshes the grid with the new value /// </summary> /// <param name="r"></param> void ImageBitmapRetrieved(IAsyncResult r) { GetImageBitmapDelegate d = (r as AsyncResult).AsyncDelegate as GetImageBitmapDelegate; GetImageBitmapArgs args = d.EndInvoke(r); // end invoke and get the handle of the row that has been updated RefreshGridForImageValue(); if (DebugDetails) { ClientLog.Message("ImageBitmapRetrieved callback called for callId: " + args.callId); } }