Example #1
0
 /// <summary>
 /// Extracts the array of data bytes and stores them in the J1708Message instance.
 /// </summary>
 /// <param name="message"></param>
 public override void ExtractMessage()
 {
     try
     {
         rawMessage = rawMessage.Substring(0, message.Length - 2); //removes the checksum from the end of the message
         Mid        = BinConvert(rawMessage[0], rawMessage[1]);
         var trimmedMessage = rawMessage.Substring(2);             //remove the MID from the message
         while (trimmedMessage.Length > 0)
         {
             var segment = new J1708MessageSegment(trimmedMessage, Mid)
             {
                 TimeReceived = this.timeReceived
             };
             int messageLength = segment.GetTotalMessageBytes() * 2;
             if (messageLength >= trimmedMessage.Length)
             {
                 trimmedMessage = string.Empty;
             }
             else
             {
                 trimmedMessage = trimmedMessage.Substring(messageLength);
             }
             CanMessageSegments.Add(segment);
         }
     }
     catch (Exception ex)
     {
         VMSConsole.PrintLine("Failed to parse " + message);
     }
 }
Example #2
0
 private void ChangeDemoImageBlock()
 {
     if (!string.IsNullOrEmpty(ImagePath.Text) && File.Exists(ImagePath.Text))
     {
         try
         {
             ImageDemo.Source = new BitmapImage(new Uri(ImagePath.Text, UriKind.Absolute));
         }
         catch (Exception ex)
         {
             VMSConsole.PrintLine(ex.ToString());
             ImageDemo.Source = null;
         }
     }
 }
Example #3
0
 public static void GenerateErrorRecord(Exception e)
 {
     VMSConsole.PrintLine(e.ToString());
 }
 private void DisplayedFiles_MouseDown(object sender, MouseButtonEventArgs e)
 {
     VMSConsole.PrintLine("The stack panel has been clicked");
 }