コード例 #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();
        }
コード例 #2
0
        public void RaisesTriggerOnEventAttach()
        {
            ImmediateTrigger trigger = new ImmediateTrigger();
            int count = 0;
            trigger.Trigger += (s, a) => ++count;

            Assert.Equal(1, count);
        }