private void HandleNamedPipeMessageReceived(ContainerEventArgs <byte[]> e)
        {
            if (e.Value.Length < 2)
            {
                // not usable
                return;
            }

            // data starts at offset 1 or later, as the first byte is the message type.
            var asciiEncoding = new ASCIIEncoding();

            switch (e.Value[0])
            {
            case MessageType.Action:
                break;

            case MessageType.Notification:
                var notificationText = asciiEncoding.GetString(e.Value, 1, e.Value.Length - 1);
                LogHandlerSingleton.Instance().LogLine(notificationText, string.Empty);
                if (this.DisplayNotifications)
                {
                    this.NotificationLogFunc?.Invoke(notificationText);
                }
                break;

            case MessageType.NormalTextMessage:
                LogHandlerSingleton.Instance().LogLine(asciiEncoding.GetString(e.Value, 1, e.Value.Length - 1), string.Empty);
                break;

            case MessageType.DebugTextMessage:
                LogHandlerSingleton.Instance().LogLine(asciiEncoding.GetString(e.Value, 1, e.Value.Length - 1), "Camera dll", true);
                break;

            case MessageType.ErrorTextMessage:
                LogHandlerSingleton.Instance().LogLine(asciiEncoding.GetString(e.Value, 1, e.Value.Length - 1), "Camera dll", false, true);
                break;
                // rest are ignored.
            }
        }
 private void _pipeServer_MessageReceived(object sender, ContainerEventArgs <byte[]> e)
 {
     HandleNamedPipeMessageReceived(e);
 }