Ejemplo n.º 1
0
        private void requestSearch()
        {
            var err = validateSearch();

            drawError(err);
            if (err != "")
            {
                return;
            }

            if (currentTask != null && !currentTask.IsCompleted)
            {
                return;
            }
            drawEnterSearch();

            var searchToken     = txSearchToken.Text;
            var regex           = cbCondRegex.Checked;
            var word            = cbCondWord.Checked;
            var ignoreCase      = !cbEnableCase.Checked;
            var includesCaption = !cbOnlyBody.Checked;

            enterTask("検索中");

            assignTask(() =>
            {
                var subTask = SqlFileFacade.RequestSearch(searchToken,
                                                          SqlMatch.withRegex(regex),
                                                          SqlMatch.withWord(word),
                                                          SqlMatch.withIgnoreCase(ignoreCase),
                                                          SqlMatch.withIncludesCaption(includesCaption))
                              .ContinueWith((t) =>
                {
                    listSqls.Clear();
                    listSqls.AddRange(t.Result);
                    this.Invoke(new Action(drawEndSearch));
                    currentTask = null;
                });
                Task.WaitAll(subTask);
            })
            .ContinueWith((t) => {
                releaseTask();
            });
        }
Ejemplo n.º 2
0
        private void requestLoadIndex()
        {
            if (currentTask != null && !currentTask.IsCompleted)
            {
                return;
            }

            drawEnterLoadIndex();

            currentTask =
                assignTask(() =>
            {
                var subTask = SqlFileFacade.RequestRefleshRepos();
                Task.WhenAll(subTask);
            })
                .ContinueWith((t) =>
            {
                this.Invoke(new Action(drawEndLoadIndex));
                currentTask = null;
            })
                .ContinueWith((t) => { requestSearch(); });
        }