private void DBType_ComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.SuspendLayout(); tableLayoutPanel1.SuspendLayout(); if (null != _connectionEditor) { this.tableLayoutPanel1.Controls.Remove(_connectionEditor.Widget); } _connectionEditor = this.DBType_comboBox.Selected as IDbEditor; _connectionEditor.Widget.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.SetColumnSpan(_connectionEditor.Widget, 2); this.tableLayoutPanel1.Controls.Add(_connectionEditor.Widget, 1, 3); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); }
/// <summary> /// Send request to each search engine, wait the fastest response and parse it /// </summary> public async Task <IEnumerable <SearchResult> > GetResultsFromFastestEngine(string searchTerm, IDbEditor db) { this.db = db; IQueryable <SearchEngine> searchEngines = db.GetEngines(); List <Task <ParseResponseStruct> > responses = new List <Task <ParseResponseStruct> >(); foreach (SearchEngine engine in searchEngines) { if (!engine.IsDisable) { responses.Add(Task.Run(() => SendWebRequestAsync(searchTerm, engine))); } } ParseResponseStruct fastestResponse = await Task.WhenAny(responses).Result; List <SearchResult> results = Parser.ParseResponse(fastestResponse); return(results); }
public HomeController(IDbEditor db, IRequester requester) { this.db = db; this.requester = requester; }