Skip to content

Commit 37799a2

Browse files
committed
Sample conversion
1 parent 5f62846 commit 37799a2

File tree

1 file changed

+50
-8
lines changed
  • Community.PowerToys.Run.Plugin.CurrencyConverter

1 file changed

+50
-8
lines changed

Community.PowerToys.Run.Plugin.CurrencyConverter/Main.cs

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Wox.Plugin;
88
using Wox.Plugin.Logger;
99
using Wox.Infrastructure.Storage;
10+
using System.Windows.Documents;
1011

1112
namespace Community.PowerToys.Run.Plugin.CurrencyConverter
1213
{
@@ -133,15 +134,56 @@ public List<Result> Query(Query query)
133134
results.AddRange(_updater.GetResults());
134135
}
135136

136-
if (!(string.IsNullOrEmpty(query.ActionKeyword) || string.IsNullOrEmpty(query.Search.Trim())))
137-
results.Add(new Result
137+
if (!string.IsNullOrEmpty(query.ActionKeyword))
138+
{
139+
if (string.IsNullOrEmpty(query.Search.Trim()))
140+
{
141+
results.AddRange([
142+
new Result()
143+
{
144+
Title = "Start typing to convert currencies",
145+
SubTitle = "Few examples are listed below",
146+
IcoPath = _iconPath,
147+
ContextData = new Dictionary<string, string> { { "externalLink", GithubReadmeURL } },
148+
Action = _ => Helper.PerformAction("externalLink", GithubReadmeURL)
149+
},
150+
new Result()
151+
{
152+
Title = "100 USD to INR",
153+
SubTitle = "Convert 100 US Dollars to Indian Rupees",
154+
IcoPath = _iconPath,
155+
ContextData = new Dictionary<string, string> { { "copy", "100 USD to INR" } },
156+
Action = _ => Helper.PerformAction("copy", "100 USD to INR")
157+
},
158+
new Result()
159+
{
160+
Title = "$100 to €",
161+
SubTitle = "Convert 100 US Dollars to Euros",
162+
IcoPath = _iconPath,
163+
ContextData = new Dictionary<string, string> { { "copy", "$100 to €" } },
164+
Action = _ => Helper.PerformAction("copy", "$100 to €")
165+
},
166+
new Result()
167+
{
168+
Title = "₽100",
169+
SubTitle = "Convert 100 Russian Rubles",
170+
IcoPath = _iconPath,
171+
ContextData = new Dictionary<string, string> { { "copy", "₽100" } },
172+
Action = _ => Helper.PerformAction("copy", "₽100")
173+
}
174+
]);
175+
} else
138176
{
139-
Title = "Loading...",
140-
SubTitle = "Please open an issue if needed.",
141-
IcoPath = _iconPath,
142-
ContextData = new Dictionary<string, string> { { "externalLink", GithubReadmeURL } },
143-
Action = _ => Helper.PerformAction("externalLink", GithubReadmeURL)
144-
});
177+
results.Add(new Result
178+
{
179+
Title = "Loading...",
180+
SubTitle = "Please open an issue if needed.",
181+
IcoPath = _iconPath,
182+
ContextData = new Dictionary<string, string> { { "externalLink", GithubReadmeURL } },
183+
Action = _ => Helper.PerformAction("externalLink", GithubReadmeURL)
184+
});
185+
}
186+
}
145187

146188
return results;
147189
}

0 commit comments

Comments
 (0)