mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Add web search feature & some UI changes.
This commit is contained in:
@@ -10,6 +10,9 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
@@ -24,5 +27,45 @@ namespace Wox
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnAdd_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string title = tbTitle.Text;
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
MessageBox.Show("Please input Title field");
|
||||
return;
|
||||
}
|
||||
|
||||
string url = tbUrl.Text;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
MessageBox.Show("Please input URL field");
|
||||
return;
|
||||
}
|
||||
|
||||
string action = tbActionword.Text;
|
||||
if (string.IsNullOrEmpty(action))
|
||||
{
|
||||
MessageBox.Show("Please input ActionWord field");
|
||||
return;
|
||||
}
|
||||
if (CommonStorage.Instance.UserSetting.WebSearches.Exists(o => o.ActionWord == action))
|
||||
{
|
||||
MessageBox.Show("ActionWord has existed, please input a new one.");
|
||||
return;
|
||||
}
|
||||
|
||||
CommonStorage.Instance.UserSetting.WebSearches.Add(new WebSearch()
|
||||
{
|
||||
ActionWord = action,
|
||||
Enabled = true,
|
||||
IconPath="",
|
||||
Url = url,
|
||||
Title = title
|
||||
});
|
||||
CommonStorage.Instance.Save();
|
||||
MessageBox.Show("Succeed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user