internal void SetEvaluation(IRSessionDataObject dataObject) { _services.MainThread().Assert(); // Is the variable gone? if (dataObject.TypeName == null) { SetError(string.Format(CultureInfo.InvariantCulture, Package.Resources.VariableGrid_Missing, dataObject.Expression)); _evaluation = null; return; } ClearError(); // Does it have the same size and shape? If so, can update in-place (without losing scrolling etc). if (_evaluation?.Dimensions.SequenceEqual(dataObject.Dimensions) == true) { VariableGrid.Refresh(); return; } // Otherwise, need to refresh the whole thing from scratch. var session = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate().RSession; VariableGrid.Initialize(new GridDataProvider(session, dataObject)); _evaluation = dataObject; }
internal void SetViewModel(IRSessionDataObject dataObject, string caption) { if (!string.IsNullOrWhiteSpace(dataObject.Expression)) { Caption = Invariant($"{Resources.VariableGrid_Caption}: {caption}"); } _gridHost.SetEvaluation(dataObject); }
public static void AssertEvaluationWrapper_ValueStartWith(IRSessionDataObject rdo, VariableExpectation expectation) { var v = (VariableViewModel)rdo; v.Name.ShouldBeEquivalentTo(expectation.Name); v.Value.Should().StartWith(expectation.Value); v.Class.ShouldBeEquivalentTo(expectation.Class); v.TypeName.ShouldBeEquivalentTo(expectation.TypeName); v.HasChildren.ShouldBeEquivalentTo(expectation.HasChildren); }
public VariableInfo(IRSessionDataObject e) { this.Name = e.Name; if (e.TypeName == "closure") { ItemType = NamedItemType.Function; } else { ItemType = NamedItemType.Variable; } }
private void DeleteCachedVariable() { if (_evaluation != null && _evaluation.Expression.StartsWithOrdinal(ViewEnvName)) { if (_rSession.IsHostRunning) { var varName = _evaluation.Expression.Substring(ViewEnvName.Length + 1); try { _rSession.ExecuteAsync(Invariant($"rm('{varName}', envir = {ViewEnvName})")).DoNotWait(); } catch (Exception ex) when(!ex.IsCriticalException()) { } } } _evaluation = null; }
public GridDataProvider(IRSession session, IRSessionDataObject dataObject) { _dataObject = dataObject; _dataSource = new GridDataSource(session); RowCount = dataObject.Dimensions[0]; ColumnCount = dataObject.Dimensions.Count >= 2 ? dataObject.Dimensions[1] : 1; CanSort = true; // Lists cannot be sorted, except when the list is a dataframe. if (dataObject.TypeName == "list") { var er = dataObject.DebugEvaluation as IRValueInfo; CanSort = er?.Classes.Contains("data.frame") == true; } }
public VariableInfo(IRSessionDataObject e) : this(e.Name, e.TypeName) { }
public static void AssertEvaluationWrapper(IRSessionDataObject rdo, VariableExpectation expectation) { var v = (EvaluationWrapper)rdo; v.ShouldBeEquivalentTo(expectation, o => o.ExcludingMissingMembers()); }
public static void AssertEvaluationWrapper(IRSessionDataObject rdo, VariableExpectation expectation) { var v = (VariableViewModel)rdo; v.ShouldBeEquivalentTo(expectation, o => o.ExcludingMissingMembers()); }