public MainViewModel() { _websiteRepository = new WebsiteRepository(); Products = new ObservableCollection <Product>(); Website = new Website(); PageToCheckCollection = new ObservableCollection <PageToCheck>(); var websiteFromDb = _websiteRepository.GetAll(); WebsiteCollection = websiteFromDb != null ? new ObservableCollection <Website>(websiteFromDb) : new ObservableCollection <Website>(); }
static void Main(string[] args) { var _websiteRepository = new WebsiteRepository(); var _websiteCollection = _websiteRepository.GetAll(); var _pageToCheckTaskList = new List <Task>(); foreach (var pageToCheck in _websiteCollection.Select(website => new PageToCheck(website.MainUrl, website.NameXPath, website.PriceXPath))) { Console.WriteLine($"Sprawdzam {pageToCheck.WebUrl} ..."); pageToCheck.AllLinkCheck += ((arg1, arg2, arg3, arg4) => Console.WriteLine( $"{arg4}{Environment.NewLine} Przeszukano: {arg2}{Environment.NewLine} Produktów: {arg1}{Environment.NewLine}")); _pageToCheckTaskList.Add(pageToCheck.Check()); } Task.WaitAll(_pageToCheckTaskList.ToArray()); }