public void EnterServer(int serverId) { Button button = ButtonServers.Where(s => s.Value.ServerId == serverId).FirstOrDefault().Key; if (button == null) { return; } button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); }
public void RemoveServer(int serverId) { Server server = ListServer.Where(s => s.ServerId == serverId).FirstOrDefault(); if (server == null) { return; } Button button = ButtonServers.Where(bs => bs.Value == server).FirstOrDefault().Key; ListServer.Remove(server); ButtonServers.Remove(button); DockPanelServerButton.Children.Remove(button); }