void HandleDetectionMessage(List <string> msg) { var message = new DetectionsMessage(); for (int i = 1; i < msg.Count; i++) { var rawDetection = msg[i].Split(','); message.Detections.Add( new Detection { DateTime = new DateTime( Convert.ToInt16(rawDetection[0]), Convert.ToInt16(rawDetection[1]), Convert.ToInt16(rawDetection[2]), Convert.ToInt16(rawDetection[3]), Convert.ToInt16(rawDetection[4]), Convert.ToInt16(rawDetection[5]), Convert.ToInt16(rawDetection[6])), TagId = rawDetection[7], HostName = rawDetection[8], Channel = Convert.ToInt16(rawDetection[9]), Amplitude = float.Parse((rawDetection[10]), CultureInfo.InvariantCulture.NumberFormat), ConfidenceLevel = float.Parse((rawDetection[11]), CultureInfo.InvariantCulture.NumberFormat), MovingStatus = SonitorConverter.ConvertToMovingStatus(Convert.ToInt16(rawDetection[12])), BatteryStatus = SonitorConverter.ConvertToBatteryStatus(Convert.ToInt16(rawDetection[13])), ButtonAState = SonitorConverter.ConvertToButtonState(Convert.ToInt16(rawDetection[14])), ButtonBState = SonitorConverter.ConvertToButtonState(Convert.ToInt16(rawDetection[15])), ButtonCState = SonitorConverter.ConvertToButtonState(Convert.ToInt16(rawDetection[16])), ButtonDState = SonitorConverter.ConvertToButtonState(Convert.ToInt16(rawDetection[17])), SelectedField = SonitorConverter.ConvertToField(Convert.ToInt16(rawDetection[18])) }); } DetectionsReceived(this, new SonitorEventArgs(message)); }
void HandleDetectionMessage( List<string> msg ) { var message = new DetectionsMessage(); for ( int i = 1; i < msg.Count; i++ ) { var rawDetection = msg[ i ].Split( ',' ); message.Detections.Add( new Detection { DateTime = new DateTime( Convert.ToInt16( rawDetection[ 0 ] ), Convert.ToInt16( rawDetection[ 1 ] ), Convert.ToInt16( rawDetection[ 2 ] ), Convert.ToInt16( rawDetection[ 3 ] ), Convert.ToInt16( rawDetection[ 4 ] ), Convert.ToInt16( rawDetection[ 5 ] ), Convert.ToInt16( rawDetection[ 6 ] ) ), TagId = rawDetection[ 7 ], HostName = rawDetection[ 8 ], Channel = Convert.ToInt16( rawDetection[ 9 ] ), Amplitude = float.Parse( ( rawDetection[ 10 ] ), CultureInfo.InvariantCulture.NumberFormat ), ConfidenceLevel = float.Parse( ( rawDetection[ 11 ] ), CultureInfo.InvariantCulture.NumberFormat ), MovingStatus = SonitorConverter.ConvertToMovingStatus( Convert.ToInt16( rawDetection[ 12 ] ) ), BatteryStatus = SonitorConverter.ConvertToBatteryStatus( Convert.ToInt16( rawDetection[ 13 ] ) ), ButtonAState = SonitorConverter.ConvertToButtonState( Convert.ToInt16( rawDetection[ 14 ] ) ), ButtonBState = SonitorConverter.ConvertToButtonState( Convert.ToInt16( rawDetection[ 15 ] ) ), ButtonCState = SonitorConverter.ConvertToButtonState( Convert.ToInt16( rawDetection[ 16 ] ) ), ButtonDState = SonitorConverter.ConvertToButtonState( Convert.ToInt16( rawDetection[ 17 ] ) ), SelectedField = SonitorConverter.ConvertToField( Convert.ToInt16( rawDetection[ 18 ] ) ) } ); } DetectionsReceived( this, new SonitorEventArgs( message ) ); }