コード例 #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
ファイル: VariableSearchTask.cs プロジェクト: jingmouren/RTVS
        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
ファイル: HelpWindowPane.cs プロジェクト: jingmouren/RTVS
            protected override void OnStartSearch()
            {
                base.OnStartSearch();
                _callback.ReportComplete(this, 1);

                var searchString = SearchQuery.SearchString;

                if (!string.IsNullOrWhiteSpace(searchString))
                {
                    SearchAsync(searchString).DoNotWait();
                }
            }
コード例 #4
0
ファイル: HelpWindowPane.cs プロジェクト: modulexcite/RTVS
            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) {
                    }
                }
            }
コード例 #6
0
        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);
        }