private void Search() { using (var scope = container.BeginLifetimeScope()) { Tuple <int, int> scanPair; ISearchEngine searchEngine = scope.Resolve <ISearchEngine>(); searchEngine.Init( SearchParameters.Access.MSMSFile, SearchParameters.Access.FastaFile, SearchParameters.Access.OutputFile); progress send = new progress((scan) => counter.Add(scan)); while ((scanPair = TryGetTask()) != null) { searchEngine.Search(scanPair.Item1, scanPair.Item2, send); } UpdateTask(searchEngine.GetResults()); } }