private void ManageReport(ReportEventArgs e) { if (e == null) return; switch (e.ReportCode) { case ReportCodes.DiskProbingStarted: SetPicBoxStatusAsync(pbSearchState, PictureBoxStatus.ImageState.Loading); break; case ReportCodes.DiskProbingFinished: SetPicBoxStatusAsync(pbSearchState, PictureBoxStatus.ImageState.Loaded); break; case ReportCodes.MassStorageInserted: SetPicBoxStatusAsync(pbMassStorageState, PictureBoxStatus.ImageState.Loading); break; case ReportCodes.IdentifyMassStorage: SetPicBoxStatusAsync(pbMassStorageState, PictureBoxStatus.ImageState.Loading); break; case ReportCodes.IdentityVerificationMassStorage: SetPicBoxStatusAsync(pbMassStorageState, PictureBoxStatus.ImageState.Loaded); break; case ReportCodes.MassStorageRejected: SetPicBoxStatusAsync(pbMassStorageState, PictureBoxStatus.ImageState.NotLoad); break; case ReportCodes.NotAllowed: SetPicBoxStatusAsync(pbMassStorageState, PictureBoxStatus.ImageState.NotLoad); break; } }
private void Reports_ReflectedReports(object sender, ReportEventArgs e) { try { if (gridViewReport.InvokeRequired) { gridViewReport.Invoke(new Action(delegate { gridViewReport.Rows.Add(CreateRow(e)); gridViewReport.ClearSelection(); gridViewReport.Rows[gridViewReport.RowCount - 1].Selected = true; })); } else if (gridViewReport.IsHandleCreated && gridViewReport.Created) { gridViewReport.Rows.Add(CreateRow(e)); gridViewReport.ClearSelection(); gridViewReport.Rows[gridViewReport.RowCount - 1].Selected = true; } } catch { } }
private DataGridViewRow CreateRow(ReportEventArgs report) { DataGridViewRow row = (DataGridViewRow)gridViewReport.RowTemplate.Clone(); row.CreateCells(gridViewReport, Interlocked.Increment(ref ReportCounter), report.Source + (report.ReportCode == ReportCodes.ExceptionHandled ? " (#EXP#)" : ""), report.OccurrenceTime_IST.ToLongDateString(), report.OccurrenceTime_IST.ToLongTimeString(), report.Message); if (report.ReportCode == ReportCodes.ExceptionHandled) row.DefaultCellStyle = new DataGridViewCellStyle() { BackColor = System.Drawing.Color.Red }; return row; }