private void BanTraders(object sender, RoutedEventArgs e) { BanList.Clear(); foreach (Main.Activity activity in ActivityDataGrid.SelectedItems) { string[] IP = activity.Address.Split('/')[0].Split('.'); if (IP.Count() > 2) { string Address = $"{IP[0]}.{IP[1]}.{IP[2]}.*"; foreach (Main.Address address in MainWindow.AddressList.Where(a => a.IP == Address)) { foreach (Main.Trader trader in MainWindow.TraderList.Where(t => t.Game == address.Game & t.Logon == address.Logon)) { if (BanList.Where(t => t.LastIP == trader.LastIP && t.Logon == trader.Logon).Count() == 0) { BanList.Add(trader); } } } } } Pages.BanTraders banTraders = new Pages.BanTraders(BanList); banTraders.MainWindow = MainWindow; banTraders.Left = MainWindow.Left + 100; banTraders.Top = MainWindow.Top + 200; banTraders.ShowDialog(); }
private void BanTraders(object sender, RoutedEventArgs e) { BanList.Clear(); foreach (Main.Trader trader in tradersDataGrid.SelectedItems) { if (BanList.Where(t => t.LastIP == trader.LastIP && t.Logon == trader.Logon).Count() == 0) { BanList.Add(MainWindow.TraderList.Where(t => t.Game == trader.Game & t.Logon == trader.Logon).First()); } } Pages.BanTraders banTraders = new Pages.BanTraders(BanList); banTraders.Left = MainWindow.Left + 100; banTraders.Top = MainWindow.Top + 200; banTraders.MainWindow = MainWindow; banTraders.ShowDialog(); }