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; } } }
private ProxiesResponse RemoveProxiesPortAndAddress(ProxiesData proxiesFromMatchmaking) { var proxies = new ProxiesResponse(); proxies.id = proxiesFromMatchmaking.id; proxies.nodeId = proxiesFromMatchmaking.nodeId; return(proxies); }
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); }
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); } } }