Ejemplo n.º 1
0
        public IPathValue NewItem(IProviderContext context, string path, string itemTypeName, object newItemValue)
        {
            ITrigger trigger = null;
            var parameter = context.DynamicParameters as TriggerNewItemParameters;
            if (null != parameter)
            {
                if (parameter.Interval.HasValue)
                {
                    trigger = new IntervalTrigger {Name = path, Interval = parameter.Interval.Value};
                }
                else if (parameter.Manual)
                {
                    trigger = new ManualTrigger {Name = path};
                }
            }

            if( null == trigger )
            {
                trigger = new ImmediateTrigger { Name = path };
            }

            _drive.Add(trigger);

            return Resolve(context, path).First().GetNodeValue();
        }
Ejemplo n.º 2
0
 public void RaisesTriggerOnSetInterval()
 {
     IntervalTrigger trigger = new IntervalTrigger();
     trigger.Interval = TimeSpan.FromMilliseconds(100);
     int count = 0;
     trigger.Trigger += (s, a) => ++count;
     Thread.Sleep( 200 );
     Assert.NotEqual( 0, count );
 }