Exemplo n.º 1
0
        private void Added(CpDeviceDiagnosticsList aList, CpDeviceDiagnostics aDevice)
        {
            List <CpDeviceDiagnosticsItem> devices = new List <CpDeviceDiagnosticsItem>();

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                CpDeviceDiagnosticsItem device;
                if (aDevice.CrashDataStatus == CpDeviceDiagnostics.ECrashDataStatus.eAvailable)
                {
                    UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsReportList: DeviceDiagnosticsReport+             Udn{" + aDevice.Udn + "}");

                    device          = new CpDeviceDiagnosticsReport(aDevice);
                    device.Changed += HandleChanged;

                    devices.Add(device);
                    iDeviceListDiagnosticsItem.Add(device);
                }

                if (aDevice.CdPlayerProblem)
                {
                    UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsReportList: DeviceDiagnosticsProxyCdPlayer+             Udn{" + aDevice.Udn + "}");

                    device          = new CpDeviceDiagnosticsProxyCdPlayer(aDevice);
                    device.Changed += HandleChanged;

                    devices.Add(device);
                    iDeviceListDiagnosticsItem.Add(device);
                }

                if (aDevice.PreampProblem)
                {
                    UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsReportList: DeviceDiagnosticsProxyPreamp+             Udn{" + aDevice.Udn + "}");

                    device          = new CpDeviceDiagnosticsProxyPreamp(aDevice);
                    device.Changed += HandleChanged;

                    devices.Add(device);
                    iDeviceListDiagnosticsItem.Add(device);
                }
            }

            foreach (CpDeviceDiagnosticsItem d in devices)
            {
                if (iAdded != null)
                {
                    iAdded(this, d);
                }
            }
        }
Exemplo n.º 2
0
        public CpDeviceDiagnosticsReportList(DebugReport aReport, ChangeHandler aAdded, ChangeHandler aRemoved)
        {
            iLock     = new object();
            iDisposed = false;

            iReport = aReport;

            iAdded   = aAdded;
            iRemoved = aRemoved;

            iDeviceListDiagnosticsItem = new List <CpDeviceDiagnosticsItem>();

            iDeviceList = new CpDeviceDiagnosticsList(Added, Removed);
        }
Exemplo n.º 3
0
        private void Removed(CpDeviceDiagnosticsList aList, CpDeviceDiagnostics aDevice)
        {
            List <CpDeviceDiagnosticsItem> devices = new List <CpDeviceDiagnosticsItem>();

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                foreach (CpDeviceDiagnosticsItem d in iDeviceListDiagnosticsItem)
                {
                    if (d.Udn == aDevice.Udn)
                    {
                        UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsReportList: DeviceDiagnosticsItem-             Udn{" + aDevice.Udn + "}");

                        devices.Add(d);
                        d.Changed -= HandleChanged;
                    }
                }

                foreach (CpDeviceDiagnosticsItem d in devices)
                {
                    iDeviceListDiagnosticsItem.Remove(d);
                }
            }

            foreach (CpDeviceDiagnosticsItem d in devices)
            {
                if (iRemoved != null)
                {
                    iRemoved(this, d);
                }

                d.Dispose();
            }
        }