PowerToys/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs
P-Storm 206397dc86
Fixed the error that Files were named Folder (#6935)
* Fixed the error that Files were named Folder

* Add and use resources in Results.

* Last item without resources in Plugin.Folder

* Changed to CurrentCulture, added N0 to Folder truncate warning.

Co-authored-by: p-storm <paul.de.man@gmail.com>
2020-10-06 09:08:41 -07:00

40 lines
1.3 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Globalization;
using Microsoft.Plugin.Folder.Sources;
using Microsoft.Plugin.Folder.Sources.Result;
using Wox.Infrastructure;
using Wox.Plugin;
namespace Microsoft.Plugin.Folder
{
public class UserFolderResult : IItemResult
{
private readonly IExplorerAction _explorerAction = new ExplorerAction();
public string Search { get; set; }
public string Title { get; set; }
public string Path { get; set; }
public string Subtitle { get; set; }
public Result Create(IPublicAPI contextApi)
{
return new Result
{
Title = Title,
IcoPath = Path,
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
QueryTextDisplay = Path,
TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },
Action = c => _explorerAction.Execute(Path, contextApi),
};
}
}
}