public UserControl_Begin(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); _mainContent = mainContent; seasonService = new SeasonService(); competitionService = new CompetitionService(); teamService = new TeamService(); matchService = new MatchService(); Thread.Sleep(1000); TextBoxNSeasons.Dispatcher.BeginInvoke((Action)(() => TextBoxNSeasons.Text = seasonService.GetSeasonsNumber().ToString())); TextBoxNCompetitions.Dispatcher.BeginInvoke((Action)(() => TextBoxNCompetitions.Text = competitionService.GetCompetitionsNumber().ToString())); TextBoxNTeams.Dispatcher.BeginInvoke((Action)(() => TextBoxNTeams.Text = teamService.GetTeamsNumber().ToString())); TextBoxNMatches.Dispatcher.BeginInvoke((Action)(() => TextBoxNMatches.Text = matchService.GetMatchesNumber().ToString())); UtilsNotification.StopLoadingAnimation(); }).Start(); }