private static IEventName ToAnonymousName(IEventName @event)
        {
            var identifier = new StringBuilder();

            identifier.AppendAnonymousMemberName(@event, @event.HandlerType);
            return(Names.Event(identifier.ToString()));
        }
 private void GenerateEventTest(int counter, int counter2, IEventName sut)
 {
     OpenTestAndDeclareSut(counter, counter2, sut);
     _sb.AppendAreEqual(sut.HandlerType, "sut.getHandlerType()");
     _sb.CloseTest();
 }
 /// <summary>
 /// Raises an event and appends it to the digitalSTROM-Server event queue.
 /// Details of the digitalSTROMServer event processing can be found in the
 /// system-interfaces document.
 /// </summary>
 /// <remarks>
 /// Notice: System events should be treated as reserved and must not be
 /// raised by external applications. In this term system events are events
 /// which originate from the digitalSTROM system lower layers.
 /// </remarks>
 /// <param name="name">Identifier for event</param>
 /// <param name="parameters">List of key-value pairs</param>
 public async Task RaiseEvent(IEventName name, List <KeyValuePair <string, string> >?parameters = null)
 {
     await Load(new Uri("/json/event/raise", UriKind.Relative)
                .AddQuery("name", name.Name).AddQuery("parameter", parameters));
 }
 /// <summary>
 /// Unsubscribes for the previously registered events by giving the event name
 /// and the unique subscriptionId.
 /// </summary>
 /// <param name="name">Identifier for the event</param>
 /// <param name="subscriptionID">Numerical unique value</param>
 public async Task Unsubscribe(IEventName name, int subscriptionID)
 {
     await Load(new Uri("/json/event/unsubscribe", UriKind.Relative)
                .AddQuery("name", name.Name).AddQuery("subscriptionID", subscriptionID));
 }
Пример #5
0
 protected static EventReference EventRef(IEventName eventName, IVariableReference declTypeRef)
 {
     return(new EventReference {
         EventName = eventName, Reference = declTypeRef
     });
 }