Exemplo n.º 1
0
        public CodeCellView(
            Models.CodeCellState codeCellState,
            CodeCell codeCell,
            HtmlDocument document,
            RendererContext rendererContext) : base(
                document,
                "submission " + codeCell.LanguageName)
        {
            this.codeCell = codeCell
                            ?? throw new ArgumentNullException(nameof(codeCell));

            this.rendererContext = rendererContext
                                   ?? throw new ArgumentNullException(nameof(rendererContext));

            ContentElement.AppendChild(editorElem = CreateContentContainer("editor"));

            editor = new CodeCellEditorView(codeCellState, codeCell, editorElem);

            PreferenceStore.Default.Subscribe(change => {
                if (change.Key == Prefs.Submissions.ShowExecutionTimings.Key)
                {
                    UpdateEvaluationDurationHidden();
                }
            });
        }
Exemplo n.º 2
0
        void HandleFocusEvent(EditorEvent evnt, Models.CodeCellState sourceCodeCellState)
        {
            var sourceCell = ((CellEditorView)evnt.Source).Cell;

            if (focusedCellState == sourceCodeCellState && focusedWorkbookCell == sourceCell)
            {
                return;
            }

            focusedCellState = sourceCodeCellState;

            UpdateFocusedCellViewFooter(false);
            focusedWorkbookCell = sourceCell;
            UpdateFocusedCellViewFooter(true);
        }
Exemplo n.º 3
0
        protected override void BindCodeCellToView(CodeCell cell, Models.CodeCellState codeCellState)
        {
            var codeCellView = new CodeCellView(
                codeCellState,
                cell,
                webView.Document,
                rendererContext);

            cell.View = codeCellView;

            codeCellState.Editor = codeCellView.Editor;
            codeCellState.View   = codeCellView;

            codeCellView.Events.Subscribe(new Observer <IEvent> (HandleCodeCellViewEvent));
        }
Exemplo n.º 4
0
 protected override Xamarin.Interactive.Workbook.Models.CodeCellState StartNewCodeCell()
 => focusedCellState = base.StartNewCodeCell();