Exemplo n.º 1
0
        private void WriteDisplayData(Message parent, object displayable, TransientDisplayData transient = null, bool isUpdate = false)
        {
            try
            {
                var serialized = EncodeForDisplay(displayable);

                // Send the engine's output to stdout.
                this.ShellServer.SendIoPubMessage(
                    new Message
                {
                    Header = new MessageHeader
                    {
                        MessageType = isUpdate
                                          ? "update_display_data"
                                          : "display_data"
                    },
                    Content = new DisplayDataContent
                    {
                        Data      = serialized.Data,
                        Metadata  = serialized.Metadata,
                        Transient = transient
                    }
                }.AsReplyTo(parent)
                    );
            }
            catch (Exception e)
            {
                this.Logger?.LogError(e, "Unexpected error when trying to write display data.");
            }
        }
Exemplo n.º 2
0
            public void UpdateDisplay(object displayable, string displayId)
            {
                var transient = new TransientDisplayData
                {
                    DisplayId = displayId
                };

                engine.WriteDisplayData(parent, displayable, transient, isUpdate: true);
            }
Exemplo n.º 3
0
            public IUpdatableDisplay DisplayUpdatable(object displayable)
            {
                var transient = new TransientDisplayData
                {
                    DisplayId = Guid.NewGuid().ToString()
                };

                engine.WriteDisplayData(parent, displayable, transient);
                return(new UpdatableDisplay(this, transient.DisplayId));
            }