Esempio n. 1
0
        private async void FillServerList()
        {
            try
            {
                List <ServerModel> list = null;
                string             servers;
                try
                {
                    servers = await ServerModel.GetServers();

                    ServerModel.Save(servers);
                }
                catch
                {
                    servers = ServerModel.Load();
                }
                list = ServerModel.ParseServersToList(servers);
                list.RemoveAll(x => x.IsEmpty());
                serverList.ItemsSource  = null;
                serverList.ItemsSource  = list;
                serverList.SelectedItem = list.Find(x => x.ID == Settings.LastServerID);
                if (NetworkSettings.ShowingServerStatus)
                {
                    if (!list.Exists(x => x.ID == NetworkSettings.OfficialServerAdress.GetHashCode()))
                    {
                        bottomInfoPanel.Text       = NetworkSettings.ServerStatus;
                        bottomInfoPanel.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        bottomInfoPanel.Visibility = Visibility.Hidden;
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error("FillServerList", e);
            }
        }