예제 #1
0
        private void SearchCompleted(Task <int> task)
        {
            switch (task.Status)
            {
            case TaskStatus.RanToCompletion:
                _searchCallback.ReportComplete(this, (uint)task.Result);
                break;

            case TaskStatus.Faulted:
            case TaskStatus.Canceled:
                _searchCallback.ReportComplete(this, 0);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #2
0
        protected override void OnStartSearch()
        {
            base.OnStartSearch();

            bool found        = false;
            var  searchString = SearchQuery.SearchString;

            if (_grid?.Items != null && !string.IsNullOrWhiteSpace(searchString))
            {
                found = Find(s => s.StartsWithOrdinal(searchString));
                if (!found)
                {
                    found = Find(s => s.Contains(searchString));
                }
            }
            if (!found)
            {
                _callback.ReportComplete(this, 0);
            }
        }
예제 #3
0
            protected override void OnStartSearch()
            {
                base.OnStartSearch();
                _callback.ReportComplete(this, 1);

                var searchString = SearchQuery.SearchString;

                if (!string.IsNullOrWhiteSpace(searchString))
                {
                    SearchAsync(searchString).DoNotWait();
                }
            }
예제 #4
0
            protected override async void OnStartSearch()
            {
                base.OnStartSearch();
                _callback.ReportComplete(this, 1);

                var searchString = SearchQuery.SearchString;

                if (!string.IsNullOrWhiteSpace(searchString))
                {
                    var session = _workflowProvider.GetOrCreate().RSession;
                    using (var inter = await session.BeginInteractionAsync()) {
                        await inter.RespondAsync("?" + searchString + Environment.NewLine);
                    }
                }
            }
예제 #5
0
            protected override async void OnStartSearch()
            {
                base.OnStartSearch();
                _callback.ReportComplete(this, 1);

                var searchString = SearchQuery.SearchString;

                if (!string.IsNullOrWhiteSpace(searchString))
                {
                    try {
                        var session = _workflowProvider.GetOrCreate().RSession;
                        await session.ExecuteAsync($"rtvs:::show_help({searchString.ToRStringLiteral()})");
                    } catch (OperationCanceledException) {
                    } catch (RException) {
                    } catch (MessageTransportException) {
                    }
                }
            }
        public void Start()
        {
            Status        = (uint)__VSSEARCHTASKSTATUS.STS_STARTED;
            StringCount   = 0;
            StopRequested = false;

            if (Designer.Model.StateMachine != null)
            {
                SearchableObjects = GatherObjects();

                foreach (ObjectModel.TrackableObject o in SearchableObjects)
                {
                    StringCount += o.Search(SearchQuery.SearchString);
                    if (StopRequested)
                    {
                        break;
                    }
                }
            }

            SearchCallback.ReportComplete(this, StringCount);
        }