public TournamentChooser()
 {
     waitWindow = new WaitWindow();
     waitWindow.Show();
     InitializeComponent();
     LoadWindow();
 }
 private void LoadWindow()
 {
     try
     {
         context = new BadmintonContext();
         //if (!TestConnection())
         //    throw new Exception();
         context.Tournaments.Load();
         TournamentsList = new BindingList <Tournament>();
         TournamentsList = context.Tournaments.Local.ToBindingList();
         tournamentsListView.ItemsSource = TournamentsList;
         context.Cities.Load();
         context.Judges.Load();
         cmbBoxCities.ItemsSource = context.Cities.Local.OrderBy(p => p.CityName).ToList();
         cmbBoxJudges.ItemsSource = context.Judges.Local.OrderBy(p => p.JudgeLastName).ToList();
     }
     catch (Exception e)
     {
         waitWindow.Close();
         waitWindow = null;
         MessageBox.Show("Не удалось подключитсья к базе данных. Проверьте интернет соединение", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         Close();
     }
     if (waitWindow != null)
     {
         waitWindow.Close();
     }
 }
Esempio n. 3
0
        public MainPage(Tournament tournament)
        {
            WaitWindow waitWindow = new WaitWindow();

            waitWindow.Show();
            InitializeComponent();
            CurrentTournament = tournament;
            Nums     = new Nums();
            Context  = new BadmintonContext();
            ListPage = new ListPage(this);

            changerFrame.Navigate(ListPage);
            #region LoadContext
            Context.Cities.Load();
            Context.Grades.Load();
            Context.Clubs.Load();
            Context.Coaches.Load();
            Context.Unions.Load();
            Context.TeamsTournaments.Load();
            Context.PlayersTeams.Load();
            #endregion
            TornamentPlayersHelper = new TornamentPlayersHelper(Context, CurrentTournament);
            EventsHelper           = new EventsHelper(Context, CurrentTournament);
            PlayersHelper          = new PlayersHelper(Context);
            Context.Configuration.AutoDetectChangesEnabled = true;
            EventsHelper.EventsLoad();
            PlayersHelper.PlayersLoad();
            TornamentPlayersHelper.TeamTournamentsLoad();
            eventsListBox.ItemsSource = EventsHelper.EventsList;
            DrawsPage = new DrawsPage(this);
            if (eventsListBox.Items.Count > 0)
            {
                eventsListBox.SelectedIndex = 0;
            }

            waitWindow.Close();
        }