private bool InitializeControllers() { try { mDriverController = new WebDriverController(); } catch (Exception) { MessageBox.Show("Web Driver'ın kurulu olduğu path'i lütfen doğru giriniz.", "Selenyum"); return(false); } mDbController = new LinkDbController((int)numMaxNumberDomainCollected.Value, (int)numMaxNumberLinkDiversity.Value, (int)numTimeout.Value, (int)numTaskCount.Value); return(true); }
private async Task <Tuple <List <string>, List <DomainInfo> > > GetCustomerShoppingPointsAsync(CustomLink curLink, int taskNumber) { string driverResult = "Driver :" + taskNumber.ToString("0000") + " WebPage : " + curLink.Url.ToString(20, ' ', true); try { if (mFlagStop) { // WriteToConsole(":( Operation is terminated by the user. Going to save the current results."); btnStop.BeginInvoke((MethodInvoker) delegate { btnStop.Enabled = false; }); UpdateTaskCount(taskNumber, true); mProcessedUrlCount++; driverResult += "\t operation canceled by user"; //driverStatues[taskNumber] = driverResult; Thread.Sleep(100); WriteToConsole(driverResult); return(null); } // WriteToConsole("TaskNumber:" + taskNumber.ToString() + "Driver kitlendi."); List <string> tempList = new List <string>(); var webDriver = new WebDriverController(); try { await webDriver.Navigate(curLink.Url, mPageLoadTimeout); Thread.Sleep(mPageLoadTimeout); } catch (Exception ex) { Thread.Sleep(100); driverResult += "\t webpage could not load. Ignoring this url"; WriteToConsole(driverResult); UpdateTaskCount(taskNumber, true); return(null); } Thread.Sleep(200); tempList = await webDriver.ExtractLinks(); Thread.Sleep(200); driverResult += "\t total extracted links :" + tempList.Count.ToString("00000"); var remainingLinkTuple = await mDbController.EliminateLinksWhoDoesntHaveDomainInfo(tempList); Thread.Sleep(200); try { driverResult += "\t remaining url count after elimination :" + remainingLinkTuple.Item1.Count.ToString("00000"); Thread.Sleep(200); WriteToConsole(driverResult); } catch (Exception) { } // WriteToConsole("Candidates are : " + mDbController.GetCandidates()); UpdateTaskCount(taskNumber, true); return(remainingLinkTuple); } catch (Exception ex) { UpdateTaskCount(taskNumber, true); mProcessedUrlCount++; driverResult = "\t task is chrashed with exception : " + ex.Message; Thread.Sleep(100); WriteToConsole(driverResult); return(null); } }