Beispiel #1
0
        private void Settins_ProxiesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
            {
                foreach (var el in e.NewItems)
                {
                    if (el is IChannel ch)
                    {
                        AddTransmitToItems(ch, false);
                    }
                }
            }
            else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
            {
                foreach (var el in e.OldItems)
                {
                    if (el == null)
                    {
                        continue;
                    }

                    TransmitToItems.RemoveAll(x => x.Channel == (IChannel)el);
                }
            }
            else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
            {
                TransmitToItems.Clear();
            }
            else
            {
                throw new NotImplementedException();
            }
        }