2015-01-03 15:20:34 +08:00
|
|
|
|
using System.Windows;
|
2014-08-13 23:16:45 +08:00
|
|
|
|
|
2015-01-03 15:20:34 +08:00
|
|
|
|
namespace Wox.Plugin.Program
|
2014-08-13 23:16:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ProgramSuffixes.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class ProgramSuffixes
|
|
|
|
|
|
{
|
2015-01-06 23:24:11 +08:00
|
|
|
|
private PluginInitContext context;
|
2016-04-21 01:53:21 +01:00
|
|
|
|
private Settings _settings;
|
2015-01-06 23:24:11 +08:00
|
|
|
|
|
2016-04-21 01:53:21 +01:00
|
|
|
|
public ProgramSuffixes(PluginInitContext context, Settings settings)
|
2014-08-13 23:16:45 +08:00
|
|
|
|
{
|
2015-01-06 23:24:11 +08:00
|
|
|
|
this.context = context;
|
2014-08-13 23:16:45 +08:00
|
|
|
|
InitializeComponent();
|
2016-03-28 03:09:57 +01:00
|
|
|
|
_settings = settings;
|
2016-08-19 20:34:20 +01:00
|
|
|
|
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.ProgramSuffixes);
|
2014-08-13 23:16:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-14 19:45:48 +08:00
|
|
|
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
2014-08-13 23:16:45 +08:00
|
|
|
|
{
|
2014-08-14 19:45:48 +08:00
|
|
|
|
if (string.IsNullOrEmpty(tbSuffixes.Text))
|
|
|
|
|
|
{
|
2015-01-06 23:24:11 +08:00
|
|
|
|
string warning = context.API.GetTranslation("wox_plugin_program_suffixes_cannot_empty");
|
|
|
|
|
|
MessageBox.Show(warning);
|
2014-08-14 19:45:48 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2014-08-13 23:16:45 +08:00
|
|
|
|
|
2016-08-19 20:34:20 +01:00
|
|
|
|
_settings.ProgramSuffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator);
|
2015-01-06 23:24:11 +08:00
|
|
|
|
string msg = context.API.GetTranslation("wox_plugin_program_update_file_suffixes");
|
|
|
|
|
|
MessageBox.Show(msg);
|
2019-08-25 17:40:59 +10:00
|
|
|
|
|
|
|
|
|
|
DialogResult = true;
|
2014-08-13 23:16:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|