2014-01-28 11:19:27 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Shapes;
|
2014-01-29 22:44:57 +08:00
|
|
|
|
using Wox.Helper;
|
|
|
|
|
using Wox.Infrastructure;
|
|
|
|
|
using Wox.Infrastructure.UserSettings;
|
2014-01-28 11:19:27 +08:00
|
|
|
|
|
2014-01-29 18:33:24 +08:00
|
|
|
|
namespace Wox
|
2014-01-28 11:19:27 +08:00
|
|
|
|
{
|
|
|
|
|
public partial class WebSearchSetting : Window
|
|
|
|
|
{
|
|
|
|
|
public WebSearchSetting()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2014-01-29 22:44:57 +08:00
|
|
|
|
|
|
|
|
|
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!");
|
|
|
|
|
}
|
2014-01-28 11:19:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|