Exemplo n.º 1
0
        /// <summary>
        /// Sends the given <see cref="ISystemAction"/> command.
        /// </summary>
        public void SendSystemCommand(ISystemAction systemCommand)
        {
            lock (locker)
            {
                // Pre-filter incompatible types.
                if (systemCommand is null)
                {
                    throw new ArgumentNullException(nameof(systemCommand));
                }
                if (!SystemCommands.Contains(systemCommand.GetType()))
                {
                    return;
                }

                Log.Debug(this, nameof(SendSystemCommand) + ": " + systemCommand);
                ExecuteSystemCommand?.Invoke(systemCommand);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the given <see cref="ISystemAction"/> event.
        /// </summary>
        public void HandleSystemEvent(ISystemAction systemEvent)
        {
            lock (locker)
            {
                // Pre-filter incompatible types.
                if (systemEvent is null)
                {
                    throw new ArgumentNullException(nameof(systemEvent));
                }
                if (!SystemEvents.Contains(systemEvent.GetType()))
                {
                    return;
                }

                Log.Debug(this, nameof(HandleSystemEvent) + ": " + systemEvent);
                events.Enqueue(systemEvent);

                // This must now be called manually from the thread that should perform the operations.
                //CheckSystems();
            }
        }