private void Added(CpDeviceDiagnosticsReportList aList, CpDeviceDiagnosticsItem aDevice) { // if we are automatically sending crash data and device is reporting crash data, send the data and don't bother to add it to the list if (iPreferences.SendDsCrashData && aDevice.Type == CpDeviceDiagnosticsItem.EDiagnosticsType.eCrash) { iDiagnosticsList.Send(aDevice.Id); } else { lock (iLock) { iDeviceListDiagnostics.Add(aDevice); iDeviceListDiagnostics.Sort(); int index = iDeviceListDiagnostics.IndexOf(aDevice); AddDevice(aDevice, index); aDevice.Changed += Changed; } if (NumDiagnosticsChanged != null) { NumDiagnosticsChanged(this, EventArgs.Empty); } } }
private void Removed(CpDeviceDiagnosticsReportList aList, CpDeviceDiagnosticsItem aDevice) { lock (iLock) { Send("DeviceRemoved", aDevice.Id); aDevice.Changed -= Changed; iDeviceListDiagnostics.Remove(aDevice); } if (NumDiagnosticsChanged != null) { NumDiagnosticsChanged(this, EventArgs.Empty); } }
public DiagnosticsPage(IInvoker aInvoker, IHelper aHelper, Preferences aPreferences, string aId, string aViewId) : base(aId, aViewId) { iLock = new object(); iInvoker = aInvoker; iPreferences = aPreferences; iPreferences.EventSendDsCrashDataChanged += HandleEventSendDsCrashDataChanged; DebugReport report = new DebugReport(string.Format("Crash log generated by {0} ver {1}", aHelper.Product, aHelper.Version)); iDiagnosticsList = new CpDeviceDiagnosticsReportList(report, Added, Removed); iDeviceListDiagnostics = new List <CpDeviceDiagnosticsItem>(); CheckAllowSendAll(); }