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(); } }); }
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); }
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)); }
protected override Xamarin.Interactive.Workbook.Models.CodeCellState StartNewCodeCell() => focusedCellState = base.StartNewCodeCell();