public bool this[int bitIndex]
{
get
{
switch (bitIndex)
{
case 0:
return CurrentBit0;
case 1:
return CurrentBit1;
case 2:
return CurrentBit2;
case 3:
return CurrentBit3;
default:
throw new IndexOutOfRangeException();
}
}
set
{
switch (bitIndex)
{
case 0:
CurrentBit0 = value;
break;
case 1:
CurrentBit1 = value;
break;
case 2:
CurrentBit2 = value;
break;
case 3:
CurrentBit3 = value;
break;
default:
throw new IndexOutOfRangeException();
}
if (CurrentBit0 == ReferenceBit0 && CurrentBit1 == ReferenceBit1 && CurrentBit2 == ReferenceBit2 && CurrentBit3 == ReferenceBit3)
{
Activated = true;
SendMessageAsync(Activated);
}
if (Activated)
{
if (!(CurrentBit0 == ReferenceBit0 && CurrentBit1 == ReferenceBit1 && CurrentBit2 == ReferenceBit2 && CurrentBit3 == ReferenceBit3))
{
Activated = false;
SendMessageAsync(Activated);
}
}
}
}