Пример #1
0
        public Answer Result(string query)
        {
            if (Icon == null)
            {
                if (IcoPath != null)
                {
                    Icon = CPublic.ToImageSource(System.Drawing.Icon.ExtractAssociatedIcon(IcoPath).ToBitmap());
                    Icon.Freeze();
                }
            }
            var result = new AnswerWithIcon
            {
                SubTitle = ShowPath,
                Icon     = Icon,
                Priority = Score(query),
                Execute  = e =>
                {
                    var info = new ProcessStartInfo
                    {
                        FileName         = FullPath,
                        WorkingDirectory = ParentDirectory
                    };
                    var hide = StartProcess(info);
                    return(Task.FromResult(new Result(hide)));
                }
            };

            if (Description.Length >= Name.Length &&
                Description.Substring(0, Name.Length) == Name)
            {
                result.Title = Description;
            }
            else if (!string.IsNullOrEmpty(Description))
            {
                result.Title = $"{Name}: {Description}";
            }
            else
            {
                result.Title = Name;
            }

            return(result);
        }