private void FireOffSearch(IGrouping <string, parseResult> newSeries, DataGridViewRow row, string customString) { string toSearch = string.IsNullOrEmpty(customString) ? newSeries.Key : customString; if (lastSearch.ContainsKey(row.Index)) { lastSearch[row.Index] = toSearch; } else { lastSearch.Add(row.Index, toSearch); } System.Threading.Interlocked.Increment(ref queuedSearches); setSearchStatus(); int iThreadCount = Environment.ProcessorCount; if (iThreadCount < 8) { iThreadCount = 8; } System.Threading.ThreadPool.SetMaxThreads(iThreadCount, iThreadCount); System.Threading.ThreadPool.QueueUserWorkItem((o) => { // tell user we are now searching SearchProgress(cSearching, null, row); GetSeries gs = new GetSeries(toSearch); // and give the results SearchProgress(toSearch, gs, row); }); }
private void SearchProgress(string searchString, GetSeries searchResult, DataGridViewRow row) { // we need to invoke if (this.dataGridViewIdentifySeries.InvokeRequired) { this.dataGridViewIdentifySeries.Invoke(new SearchProgressDelegate(SearchProgress), searchString, searchResult, row); return; } // lets update the combobox var comboCell = new DataGridViewComboBoxCell(); row.Cells[ColIndexOf(colOSeries)] = comboCell; // ok, if we only get a string and the row, display that string if (searchResult == null) { displayValsInCBCell(comboCell, searchString); // this also means that a queued search went into active status System.Threading.Interlocked.Decrement(ref queuedSearches); System.Threading.Interlocked.Increment(ref activeSearches); setSearchStatus(); return; } // else we got the results comboCell.Tag = searchResult.Results; // which also means an active search has finished System.Threading.Interlocked.Decrement(ref activeSearches); setSearchStatus(); displayValsInCBCell(comboCell, searchResult.Results.Select(r => getDisplayStringForSeries(r)).ToArray()); if (comboCell.Items.Count < 1) { displayValsInCBCell(comboCell, "No Results found"); } var actionCell = row.Cells[ColIndexOf(colAction)] as DataGridViewComboBoxCell; // overwrite from the cellchanged event which set it to approved if (searchResult.PerfectMatch == null) { actionCell.Value = displayedActions[UserInputResults.SeriesAction.Skip]; } }
private void SearchProgress(string searchString, GetSeries searchResult, DataGridViewRow row) { // we need to invoke if (this.dataGridViewIdentifySeries.InvokeRequired) { this.dataGridViewIdentifySeries.Invoke(new SearchProgressDelegate(SearchProgress), searchString, searchResult, row); return; } // lets update the combobox var comboCell = new DataGridViewComboBoxCell(); row.Cells[ColIndexOf(colOSeries)] = comboCell; // ok, if we only get a string and the row, display that string if (searchResult == null) { displayValsInCBCell(comboCell, searchString); // this also means that a queued search went into active status System.Threading.Interlocked.Decrement(ref queuedSearches); System.Threading.Interlocked.Increment(ref activeSearches); setSearchStatus(); return; } // else we got the results comboCell.Tag = searchResult.Results; // which also means an active search has finished System.Threading.Interlocked.Decrement(ref activeSearches); setSearchStatus(); displayValsInCBCell(comboCell, searchResult.Results.Select(r => getDisplayStringForSeries(r)).ToArray()); if (comboCell.Items.Count < 1) displayValsInCBCell(comboCell, "No Results found"); var actionCell = row.Cells[ColIndexOf(colAction)] as DataGridViewComboBoxCell; // overwrite from the cellchanged event which set it to approved if (searchResult.PerfectMatch == null) actionCell.Value = displayedActions[UserInputResults.SeriesAction.Skip]; }
public ISeriesModel Any(GetSeries request) { return(workflow.Get(request.ID)); }
private void FireOffSearch(IGrouping<string, parseResult> newSeries, DataGridViewRow row, string customString) { string toSearch = string.IsNullOrEmpty(customString) ? newSeries.Key : customString; if(lastSearch.ContainsKey(row.Index)) lastSearch[row.Index] = toSearch; else lastSearch.Add(row.Index, toSearch); System.Threading.Interlocked.Increment(ref queuedSearches); setSearchStatus(); int iThreadCount = Environment.ProcessorCount; if (iThreadCount < 8) iThreadCount = 8; System.Threading.ThreadPool.SetMaxThreads(iThreadCount, iThreadCount); System.Threading.ThreadPool.QueueUserWorkItem((o) => { // tell user we are now searching SearchProgress(cSearching, null, row); GetSeries gs = new GetSeries(toSearch); // and give the results SearchProgress(toSearch, gs, row); }); }