Example #1
0
        public override void Build()
        {
            if (Chunk.Type > MessageType.SerializedObject)
            {
                SerializedObject = ViewContent.Session.GetCachedObject(Chunk.SequenceNumber, Chunk.GetSerializedObject);
            }

            Fragment fragment;
            double   height;

            if (Chunk.Type == MessageType.ConnectionBanner && ViewContent.Session.ConnectionBanner != null)
            {
                // show connection info instead "Connecting to ..."
                fragment = new ConnectionFragment()
                {
                    Model = ViewContent.Session.ConnectionBanner
                };
                height = 76;
            }
            else if (Chunk.Type == MessageType.SslHandshake)
            {
                fragment = new SslHandshakeFragment()
                {
                    Model = (SslHandshake)SerializedObject
                };
                height = 45;
            }
            else
            {
                fragment = new MessageFragment();
                height   = 56;
            }

            ViewContent.MoveInsertionPointToLineBeginning();

            fragment.Source           = this;
            fragment.Bounds           = new Rect(0, ViewContent.InsertionPoint.Y, ViewContent.Metrics.Viewport.Width, ViewContent.SnapToPixelsY(height));
            fragment.ApproxFileOffset = Chunk.ActualOffset;
            fragment.ApproxFileLength = Chunk.ActualLength;

            ViewContent.TextLayer.Add(fragment);
            ViewContent.MoveInsertionPointToLineBeginning();
        }