Esempio n. 1
0
 public void PublishEvaluation(
     CodeCellId codeCellid,
     object result,
     EvaluationResultHandling resultHandling = EvaluationResultHandling.Replace)
 => MainThread.Post(() => PublishEvaluation(new Evaluation {
     CodeCellId     = codeCellid,
     ResultHandling = resultHandling,
     Result         = RepresentationManager.Prepare(result)
 }));
Esempio n. 2
0
 public Evaluation(
     CodeCellId codeCellId,
     EvaluationResultHandling resultHandling,
     object value)
     : this(
         codeCellId,
         EvaluationStatus.Success,
         resultHandling,
         value,
         evaluationDuration : default) // to avoid calling self
 {
 }
Esempio n. 3
0
        public void RenderResult(
            CultureInfo cultureInfo,
            object result,
            EvaluationResultHandling resultHandling)
        {
            if (resultElem == null)
            {
                ContentElement.AppendChild(resultElem = CreateContentContainer("result"));
            }
            else if (resultHandling == EvaluationResultHandling.Replace)
            {
                resultElem.RemoveChildren();
            }

            rendererContext.Render(
                RenderState.Create(result, cultureInfo),
                resultElem);
        }
Esempio n. 4
0
        internal Evaluation(
            CodeCellId codeCellId,
            EvaluationStatus status,
            EvaluationResultHandling resultHandling,
            object value,
            TimeSpan evaluationDuration = default,
            int cultureLCID             = 0,
            int uiCultureLCID           = 0,
            bool initializedIntegration = false,
            IReadOnlyList <AssemblyDefinition> loadedAssemblies = null)
        {
            CodeCellId     = codeCellId;
            Status         = status;
            ResultHandling = resultHandling;

            switch (value)
            {
            case null:
                ResultRepresentations = Array.Empty <object> ();
                break;

            case RepresentedObject representedObject:
                ResultType            = representedObject.RepresentedType;
                ResultRepresentations = representedObject;
                break;

            default:
                ResultType            = RepresentedType.Lookup(value.GetType());
                ResultRepresentations = new [] { value };
                break;
            }

            EvaluationDuration     = evaluationDuration;
            CultureLCID            = cultureLCID;
            UICultureLCID          = uiCultureLCID;
            InitializedIntegration = initializedIntegration;
            LoadedAssemblies       = loadedAssemblies ?? Array.Empty <AssemblyDefinition> ();
        }
Esempio n. 5
0
        public CodeCellResultEvent(
            CodeCellId codeCellId,
            EvaluationResultHandling resultHandling,
            object value)
        {
            CodeCellId     = codeCellId;
            ResultHandling = resultHandling;

            switch (value)
            {
            case null:
                break;

            case RepresentedObject representedObject:
                Type = representedObject.RepresentedType;
                ValueRepresentations = representedObject;
                break;

            default:
                Type = RepresentedType.Lookup(value.GetType());
                ValueRepresentations = new [] { value };
                break;
            }
        }
Esempio n. 6
0
        void ICodeCellView.RenderResult(
            CultureInfo cultureInfo,
            object result,
            EvaluationResultHandling resultHandling)
        {
            RenderBuffer();

            if (result is RepresentedObject representedObject)
            {
                var interactiveObject = representedObject
                                        .OfType <InteractiveObject> ()
                                        .FirstOrDefault();
                if (interactiveObject != null)
                {
                    result = interactiveObject.ToStringRepresentation;
                }
                else
                {
                    result = "<unable to represent>";
                }
            }

            output.WriteLine(result);
        }
Esempio n. 7
0
 Evaluation(
     CodeCellId codeCellId,
     EvaluationStatus status,
     EvaluationResultHandling resultHandling,
     IRepresentedType resultType,
     IReadOnlyList <object> resultRepresentations,
     bool resultIsException,
     TimeSpan evaluationDuration,
     int cultureLCID,
     int uiCultureLCID,
     bool initializedIntegration,
     IReadOnlyList <AssemblyDefinition> loadedAssemblies)
 {
     CodeCellId             = codeCellId;
     Status                 = status;
     ResultHandling         = resultHandling;
     ResultType             = resultType;
     ResultRepresentations  = resultRepresentations;
     EvaluationDuration     = evaluationDuration;
     CultureLCID            = cultureLCID;
     UICultureLCID          = uiCultureLCID;
     InitializedIntegration = initializedIntegration;
     LoadedAssemblies       = loadedAssemblies;
 }
 public void PublishValueForCell(CodeCellId codeCellId, object result, EvaluationResultHandling resultHandling = EvaluationResultHandling.Replace);
 public Evaluation(CodeCellId codeCellId, EvaluationResultHandling resultHandling, object value);
Esempio n. 10
0
 public void RenderResult(CultureInfo cultureInfo, object result, EvaluationResultHandling resultHandling)
 {
 }
Esempio n. 11
0
 public CodeCellResultEvent(CodeCellId codeCellId, EvaluationResultHandling resultHandling, object value);