Example #1
0
        public void RunBeforeAnyTests()
        {
            if (!EverythingState.IsStarted())
            {
                EverythingState.StartService(true, EverythingState.StartMode.Service);
            }

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            while (!EverythingState.IsReady() && stopwatch.ElapsedMilliseconds < Timeout)
            {
                var lastError = EverythingState.GetLastError();
                Assert.Warn($"Current Everything error code: {lastError}");
                Thread.Sleep(200);
            }

            stopwatch.Stop();

            if (stopwatch.ElapsedMilliseconds > Timeout)
            {
                Assert.Fail("Could not start Everything process");
            }
            else
            {
                Assert.Warn($"Everything version: {EverythingState.GetVersion()}");
            }
        }
        private void SearchExecute(object parameter)
        {
            if (!EverythingState.IsStarted())
            {
                EverythingState.StartService(true, EverythingState.StartMode.Service);
            }

            ProcessingTime = 0;
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var queryable = SelectedQueryCategory.GetQueryable(everything);

            everything.Reset();
            Results.Clear();
            Task.Factory.StartNew(() =>
            {
                foreach (var result in queryable)
                {
                    Results.Add(result);
                }
                stopwatch.Stop();

                ProcessingTime = stopwatch.ElapsedMilliseconds;
                ResultCount    = queryable.Count;
                OnPropertyChanged(nameof(ResultCount));
                OnPropertyChanged(nameof(Results));
            });
        }