protected void RaisePixelChanged(int position)
{
if (suspended)
{
if (!suspendedStart.HasValue || position < suspendedStart.Value)
suspendedStart = position;
if (!suspendedEnd.HasValue || position > suspendedEnd.Value)
suspendedEnd = position;
return;
}
var handler = PixelChanged;
if (handler != null)
handler(this, new PixelChangedEventArgs(position, this.color[position], this.brightness[position]));
foreach (var pixelDevice in this.devices)
{
if (pixelDevice.IsPositionForThisDevice(position))
{
handler = pixelDevice.PixelChanged;
if (handler != null)
handler(this, new PixelChangedEventArgs(position - pixelDevice.StartPosition, this.color[position], this.brightness[position]));
}
}
}