private bool CheckIfTagExists(Detection detection)
 {
     if (!Detectors.ContainsKey(detection.HostName))
     {
         Tags.Remove(detection.TagId);
         return false;
     }
     return true;
 }
        void CheckDetectorChanges( Detection detection )
        {
            if ( Tags[ detection.TagId ].Detector != null )
            {
                if ( detection.HostName != Tags[ detection.TagId ].Detector.HostName )
                {
                    Tags[ detection.TagId ].Detector.DetachTag( Tags[ detection.TagId ] );
                    TagLeave( Tags[ detection.TagId ].Detector, new TagEventArgs( Tags[ detection.TagId ] ) );

                    Detectors[ detection.HostName ].AttachTag( Tags[ detection.TagId ] );
                    Tags[ detection.TagId ].Detector = Detectors[ detection.HostName ];
                    TagEnter( Detectors[ detection.HostName ], new TagEventArgs( Tags[ detection.TagId ] ) );
                }
            }
            else
            {
                if (!CheckIfTagExists(detection))
                    return;

                Detectors[ detection.HostName ].AttachTag( Tags[ detection.TagId ] );
                Tags[ detection.TagId ].Detector = Detectors[ detection.HostName ];
                TagEnter( Detectors[ detection.HostName ], new TagEventArgs( Tags[ detection.TagId ] ) );
            }
        }
        void CheckTagButtonData( Detection detection )
        {
            if ( Tags[ detection.TagId ].ButtonA != detection.ButtonAState ||
                 Tags[ detection.TagId ].ButtonB != detection.ButtonBState ||
                 Tags[ detection.TagId ].ButtonC != detection.ButtonCState ||
                 Tags[ detection.TagId ].ButtonD != detection.ButtonDState )
            {
                Tags[ detection.TagId ].ButtonA = detection.ButtonAState;
                Tags[ detection.TagId ].ButtonB = detection.ButtonBState;
                Tags[ detection.TagId ].ButtonC = detection.ButtonCState;
                Tags[ detection.TagId ].ButtonD = detection.ButtonDState;

                TagButtonDataReceived( Tags[ detection.TagId ], new TagEventArgs( Tags[ detection.TagId ] ) );
            }
        }
 void CheckBatteryData( Detection detection )
 {
     if ( Tags[ detection.TagId ].BatteryStatus != detection.BatteryStatus )
     {
         Tags[ detection.TagId ].BatteryStatus = detection.BatteryStatus;
         TagBatteryDataReceived( Tags[ detection.TagId ], new TagEventArgs( Tags[ detection.TagId ] ) );
     }
 }
 void CheckTagMove( Detection detection )
 {
     if ( Tags[ detection.TagId ].MovingStatus != detection.MovingStatus )
     {
         Tags[ detection.TagId ].MovingStatus = detection.MovingStatus;
         TagMoved( Detectors[ detection.HostName ], new TagEventArgs( Tags[ detection.TagId ] ) );
     }
 }