public BanPlayerViewModel(Guid?serverId, string playerGuid, bool isOnline, IBanHelper playerHelper, string playerName, string playerNum) { _playerGuid = playerGuid; _isOnline = isOnline; _playerHelper = playerHelper; _playerName = playerName; _playerNum = playerNum; _minutes = 0; using (var repo = new ServerInfoRepository()) Servers = repo.GetActiveServerInfo().OrderBy(x => x.Name).ToList(); if (string.IsNullOrEmpty(playerName)) { using (var userRepo = new PlayerRepository()) { var player = userRepo.GetPlayer(playerGuid); _playerName = player?.Name; } } SelectedServers = new ObservableCollection <ServerInfo>(); if (serverId.HasValue) { SelectedServers.AddRange(Servers.Where(s => s.Id == serverId.Value)); } }
private static void Main() { XmlConfigurator.Configure(); var log = new Log(); log.Info("Startup"); IEnumerable <ServerInfo> servers; using (var dc = new ServerInfoRepository()) { servers = dc.GetActiveServerInfo(); } var models = servers.Select(x => OpenServerInfo(x, log)).ToList(); while (true) { try { var t = Task.Run(() => Run(models)); t.Wait(); } catch (Exception ex) { log.Error(ex); } } }
private void LoadedWindow(object sender, RoutedEventArgs e) { using (var r = new ServerInfoRepository()) { var servers = r.GetActiveServerInfo(); foreach (var server in servers) { OpenServerInfo(server); } } }