public void Update(CycleCompletedArgs results) { var delta = results.FullResult ?? (IViewResultModel)results.DeltaResult; var indexedResults = delta.AllResults.ToLookup(v => v.ComputedValue.Specification.TargetSpecification.Uid); UpdatePortfolioRows(PortfolioRows, indexedResults); UpdatePrimitiveRows(_primitiveRows, indexedResults); InvokeResultReceived(EventArgs.Empty); }
public static void WithViewCycle(Action <ViewDefinitionCompiledArgs, IViewCycle, RemoteViewClient> action, string viewName = "Demo Equity Option Test View") { using (var executedMre = new ManualResetEventSlim(false)) using (var remoteViewClient = Context.ViewProcessor.CreateClient()) { ViewDefinitionCompiledArgs compiled = null; CycleCompletedArgs cycle = null; JavaException error = null; var listener = new EventViewResultListener(); listener.ProcessCompleted += delegate { executedMre.Set(); }; listener.CycleCompleted += delegate(object sender, CycleCompletedArgs e) { cycle = e; executedMre.Set(); }; listener.ViewDefinitionCompiled += delegate(object sender, ViewDefinitionCompiledArgs e) { compiled = e; }; listener.ViewDefinitionCompilationFailed += delegate(object sender, ViewDefinitionCompilationFailedArgs e) { error = e.Exception; executedMre.Set(); }; remoteViewClient.SetResultListener(listener); remoteViewClient.SetViewCycleAccessSupported(true); remoteViewClient.AttachToViewProcess(viewName, ExecutionOptions.SingleCycle); Assert.Null(remoteViewClient.CreateLatestCycleReference()); executedMre.Wait(TimeSpan.FromMinutes(1)); Assert.Null(error); Assert.NotNull(compiled); Assert.NotNull(cycle); using (var engineResourceReference = remoteViewClient.CreateLatestCycleReference()) { action(compiled, engineResourceReference.Value, remoteViewClient); } } }