Beispiel #1
0
        private async Task Init(IServerInfoRepository infoRepository, Guid?serverId)
        {
            Servers = (await infoRepository.GetActiveServerInfoAsync()).OrderBy(x => x.Name).ToList();


            if (string.IsNullOrEmpty(_playerName))
            {
                using (var userRepo = new PlayerRepository())
                {
                    var player = await userRepo.GetPlayerAsync(_playerGuid);

                    _playerName = player?.Name;
                }
            }

            //SelectedServers = new ObservableCollection<ServerInfoDto>();

            if (serverId.HasValue)
            {
                SelectedServers.AddRange(Servers.Where(s => s.Id == serverId.Value));
            }

            Reasons = await GetReasons();

            BanTimes = await GetBanTimes();

            RaisePropertyChanged(nameof(Reasons));
            RaisePropertyChanged(nameof(BanTimes));
        }
        private async void LoadedWindow(object sender, RoutedEventArgs e)
        {
            var servers = await _infoRepository.GetActiveServerInfoAsync();

            foreach (var server in servers)
            {
                OpenServerInfoAsync(server);
            }
        }