private void loadFromVK_Click(object sender, RoutedEventArgs e) { loadFromVK.IsEnabled = false; long limit = 0; if (!long.TryParse(txtLimit.Text, out limit)) { limit = 0; } Task parallelLoad = new Task(new Action(() => { var user = (new Connectors.VK.VKUser()).GetUserInfo(); var _posts = Processor.GetAllPosts(user, limit); var groups = Processor.GetAllUsersGroups(user); var friends = Processor.GetAllUsersFriends(user); loadImages = false; this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() => { loadImages = checkLoadImages.IsChecked.Value; })); Posts = Processor.AddInformationAboutSourceToPosts(_posts, user, loadImages); })); parallelLoad.Start(); }