コード例 #1
0
        public async Task RemoveBehaviourAsync(string reference)
        {
            var found = Behaviours.Where(b => b.UniqueReference == reference).ToList();

            Behaviours.RemoveAll(b => b.UniqueReference == reference);
            UpdateFrameProcessors();
            if (Connection == ConnectedState.Connected)
            {
                foreach (var behaviour in found)
                {
                    if (behaviour.ActionOnRemoved != null)
                    {
                        EnqueueAction(behaviour.ActionOnRemoved);
                    }
                }
                await ActOnAnyBehaviourPermanentRequirements();
                await UnregisterBehavioursAsync(found);
            }

            OnBehaviourEvent?.Invoke(Behaviours, BehaviourEvent.Remove);
        }