private async void UpdateInfoButton_Click(object sender, RoutedEventArgs e) { using (var browser = new IE()) { var task = (Task)this.DataContext; await System.Threading.Tasks.Task.Factory.StartNew(() => { TaskScraper.UpdateTaskInfo(task, browser); }); } }
// ReSharper disable once InconsistentNaming private static void Main(string[] args) { var tasks = new HashSet <Task>(); using (var browser = new IE()) { var taskLinks = TaskScraper.GetAllLinks(browser); foreach (var link in taskLinks) { var task = TaskScraper.GetTaskInfo(link, browser); tasks.Add(task); } } foreach (var task in tasks) { if (XmlTaskDatabase.Instance.Tasks.Contains(task)) { XmlTaskDatabase.Instance.Tasks.Remove(task); } XmlTaskDatabase.Instance.Tasks.Add(task); } }