public void StartReceiveMessage(ReceivedMessageHandler callback) { var ctx = BatchContextSafeHandle.Create(); completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedMessage())); grpcsharp_call_recv_message(this, ctx).CheckOk(); }
public static bool UnregisterHandler(string SenderFilter, ReceivedMessageHandler Handler) { if (!SessionHandlers.ContainsKey(SenderFilter)) { return(false); } return(SessionHandlers[SenderFilter].Remove(Handler)); }
/// <summary> /// Subscribes a session-level handler to the message received event from given sender. /// </summary> /// <param name="SenderFilter">A DataMessage.SenderName on which the handler will be invoked.</param> public static bool RegisterHandler(string SenderFilter, ReceivedMessageHandler Handler) { if (!SessionHandlers.ContainsKey(SenderFilter)) { SessionHandlers.Add(SenderFilter, new HashSet <ReceivedMessageHandler>()); } var Handlers = SessionHandlers[SenderFilter]; return(Handlers.Add(Handler)); }
public static bool UnregisterHandler(IMyEntity Entity, string SenderFilter, ReceivedMessageHandler Handler) { long EntityID = Entity.EntityId; if (!EntityHandlersCollection.ContainsKey(EntityID)) { return(false); } if (!EntityHandlersCollection[EntityID].ContainsKey(SenderFilter)) { return(false); } return(EntityHandlersCollection[EntityID][SenderFilter].Remove(Handler)); }
/// <summary> /// Subscribes an entity-level handler to the message received event from given sender about the given entity. /// <para /> /// Useful for entity gamelogic components. Absolutely not useful for entity components. /// </summary> /// <param name="SenderName">A DataMessage.SenderName on which the handler will be invoked.</param> public static bool RegisterHandler(IMyEntity Entity, string SenderName, ReceivedMessageHandler Handler) { long EntityID = Entity.EntityId; if (!EntityHandlersCollection.ContainsKey(EntityID)) { EntityHandlersCollection.Add(EntityID, new Dictionary <string, HashSet <ReceivedMessageHandler> >()); } var EntityHandlers = EntityHandlersCollection[EntityID]; if (!EntityHandlers.ContainsKey(SenderName)) { EntityHandlers.Add(SenderName, new HashSet <ReceivedMessageHandler>()); } return(EntityHandlers[SenderName].Add(Handler)); }
public void StartReceiveMessage(ReceivedMessageHandler callback) { using (completionQueue.NewScope()) { var ctx = BatchContextSafeHandle.Create(); completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedMessage())); Native.grpcsharp_call_recv_message(this, ctx).CheckOk(); } }
public void StartReceiveMessage(ReceivedMessageHandler callback) { ReceivedMessageHandler = callback; }
public void StartReceiveMessage(ReceivedMessageHandler callback) { ReceivedMessageHandler = callback; }
public static bool UnregisterHandler(ReceivedMessageHandler Handler) { return(GeneralHandlers.Remove(Handler)); }
/// <summary> /// Subscribes a monitor-level handler to ALL received messages. /// </summary> public static bool RegisterHandler(ReceivedMessageHandler Handler) { return(GeneralHandlers.Add(Handler)); }