Beispiel #1
0
        protected override List <Result> QueryInternal(Query query)
        {
            if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1)
            {
                return(new List <Result>());
            }

            var            fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
            List <Program> returnList  = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();

            returnList.ForEach(ScoreFilter);
            //return ordered list instead of return the score, because programs scores will affect other
            //plugins, the weight of program should be less than the plugins when they showed at the same time.
            returnList = returnList.OrderByDescending(o => o.Score).ToList();

            return(returnList.Select(c => new Result()
            {
                Title = c.Title,
                SubTitle = c.ExecutePath,
                IcoPath = c.IcoPath,
                Score = 0,
                Action = (e) =>
                {
                    context.HideApp();
                    context.ShellRun(c.ExecutePath);
                    return true;
                }
            }).ToList());
        }
Beispiel #2
0
        public List <Result> Query(Query query)
        {
            var queryString = query.GetAllRemainingParameter();

            S.CoreStuff.WindowList.Clear();
            S.CoreStuff.GetWindows();

            var filterResults = S.CoreStuff.FilterList(queryString).ToList();

            return(filterResults.Select(o =>
            {
                return new Result()
                {
                    Title = o.AppWindow.Title,
                    SubTitle = o.AppWindow.ProcessTitle,
                    IcoPath = IconImageDataUri(o.AppWindow),
                    Action = con =>
                    {
                        context.HideApp();
                        if (con.SpecialKeyState.CtrlPressed)
                        {
                            o.AppWindow.PostClose();
                            o.AppWindow.SwitchTo();
                        }
                        else
                        {
                            o.AppWindow.SwitchTo();
                        }
                        return true;
                    }
                };
            }).ToList());
        }
Beispiel #3
0
        protected override List <Result> QueryInternal(Query query)
        {
            if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1)
            {
                return(new List <Result>());
            }

            var             fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
            List <Bookmark> returnList  = bookmarks.Where(o => MatchProgram(o, fuzzyMather)).ToList();

            returnList = returnList.OrderByDescending(o => o.Score).ToList();
            return(returnList.Select(c => new Result()
            {
                Title = c.Name,
                SubTitle = "Bookmark: " + c.Url,
                IcoPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\bookmark.png",
                Score = 5,
                Action = (e) =>
                {
                    context.HideApp();
                    context.ShellRun(c.Url);
                    return true;
                }
            }).ToList());
        }
Beispiel #4
0
        public List <Result> Query(Query query)
        {
            var           results     = new List <Result>();
            List <string> displayData = new List <string>();

            if (query.ActionParameters.Count == 0)
            {
                displayData = dataList;
            }
            else
            {
                displayData = dataList.Where(i => i.ToLower().Contains(query.GetAllRemainingParameter().ToLower()))
                              .ToList();
            }

            results.AddRange(displayData.Select(o => new Result
            {
                Title   = o,
                IcoPath = "Images\\clipboard.png",
                Action  = c =>
                {
                    if (c.SpecialKeyState.CtrlPressed)
                    {
                        context.ShowCurrentResultItemTooltip(o);
                        return(false);
                    }
                    else
                    {
                        System.Windows.Forms.Clipboard.SetText(o);
                        context.HideApp();
                        keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_V);
                        return(true);
                    }
                }
            }).Reverse());
            return(results);
        }