public void Cast_NotContextImplicitDynamic_IsNotCastableToTopContext() { dynamic context = new DynamicContext(new NotContext(), new JObject()); TopContext casted = context; Assert.That(casted, Is.Null); }
public void Cast_BottomContextExplicitDynamic_IsCastableToTopContext() { dynamic context = new DynamicContext(new BottomContext(), new JObject()); TopContext casted = (TopContext)context; Assert.That(casted, Is.Not.Null); }
void ChangeDevice(Device device) { if (device != null) { device.ProcessesChanged += this.Device_ProcessesChanged; this.topContext?.Close(); this.topContext = TopContext.Start(device, this.kTopIntervalSeconds, this.TopContext_Received); } else { this.topContext?.Close(); } this.UpdateControlState(); }
public virtual IContext GetContext() { var context = _contextLifetimeManager.Find(DefaultContextKey) as IContext; if (context == null) { context = new TopContext(); _contextLifetimeManager.Store(DefaultContextKey, context); _logger.Debug("Top context created and stored."); } else { context = new ChildContext(context); _logger.Debug("Child context created."); } return(context); }
public virtual IContext GetContext() { var context = _contextLifetimeManager.Find(DefaultContextKey) as IContext; if (context == null) { context = new TopContext(); _contextLifetimeManager.Store(DefaultContextKey, context); _logger.Debug("Top context created and stored."); } else { context = new ChildContext(context); _logger.Debug("Child context created."); } return context; }