Esempio n. 1
0
        private void OnProxiesRemoveCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action != System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
            {
                return;
            }

            foreach (var el in e.OldItems)
            {
                try
                {
                    if (el is IChannelProxy proxy)
                    {
                        _context.Post((s) =>
                        {
                            ProxiesData.Remove(ProxiesData.First(x => x.ChannelProxy == el));
                        }, null);
                    }
                }
                catch
                {
                    return;
                }
            }
        }
Esempio n. 2
0
        private ProxiesResponse RemoveProxiesPortAndAddress(ProxiesData proxiesFromMatchmaking)
        {
            var proxies = new ProxiesResponse();

            proxies.id     = proxiesFromMatchmaking.id;
            proxies.nodeId = proxiesFromMatchmaking.nodeId;
            return(proxies);
        }
Esempio n. 3
0
        private void OnProxiesResetCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action != System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
            {
                return;
            }

            _context.Post((s) => { ProxiesData.Clear(); }, null);
        }
Esempio n. 4
0
        private void OnProxiesAddCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action != System.Collections.Specialized.NotifyCollectionChangedAction.Add)
            {
                return;
            }

            foreach (var el in e.NewItems)
            {
                if (el is IChannelProxy proxy)
                {
                    var buf = new ProxyChannelViewData(proxy);
                    buf.DeletedEvent += ProxyRemoved;

                    _context.Post((s) =>
                    {
                        ProxiesData.Add(buf);
                    }, null);
                }
            }
        }