2018-12-25 15:11:24 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
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.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin.Url
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// SettingsControl.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class SettingsControl : UserControl
|
|
|
|
|
{
|
|
|
|
|
private Settings _settings;
|
|
|
|
|
private IPublicAPI _woxAPI;
|
|
|
|
|
|
|
|
|
|
public SettingsControl(IPublicAPI woxAPI,Settings settings)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_settings = settings;
|
|
|
|
|
_woxAPI = woxAPI;
|
|
|
|
|
browserPathBox.Text = _settings.BrowserPath;
|
2019-11-11 03:49:17 +08:00
|
|
|
|
NewWindowBrowser.IsChecked = _settings.OpenInNewBrowserWindow;
|
|
|
|
|
NewTabInBrowser.IsChecked = !_settings.OpenInNewBrowserWindow;
|
2018-12-25 15:11:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnApplyBTClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_settings.BrowserPath = browserPathBox.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnChooseClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var fileBrowserDialog = new OpenFileDialog();
|
|
|
|
|
fileBrowserDialog.Filter = _woxAPI.GetTranslation("wox_plugin_url_plugin_filter"); ;
|
|
|
|
|
fileBrowserDialog.CheckFileExists = true;
|
|
|
|
|
fileBrowserDialog.CheckPathExists = true;
|
|
|
|
|
if (fileBrowserDialog.ShowDialog() == true)
|
|
|
|
|
{
|
|
|
|
|
browserPathBox.Text = fileBrowserDialog.FileName;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-11 03:49:17 +08:00
|
|
|
|
|
|
|
|
|
private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_settings.OpenInNewBrowserWindow = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnNewTabClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_settings.OpenInNewBrowserWindow = false;
|
|
|
|
|
}
|
2018-12-25 15:11:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|