2021-07-04 12:05:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows;
|
2022-10-22 09:02:20 +00:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
using System.Windows.Input;
|
2014-08-13 15:16:45 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.Program
|
2014-08-13 15:16:45 +00:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ProgramSuffixes.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class ProgramSuffixes
|
|
|
|
|
|
{
|
2015-01-06 15:24:11 +00:00
|
|
|
|
private PluginInitContext context;
|
2016-04-21 00:53:21 +00:00
|
|
|
|
private Settings _settings;
|
2015-01-06 15:24:11 +00:00
|
|
|
|
|
2016-04-21 00:53:21 +00:00
|
|
|
|
public ProgramSuffixes(PluginInitContext context, Settings settings)
|
2014-08-13 15:16:45 +00:00
|
|
|
|
{
|
2015-01-06 15:24:11 +00:00
|
|
|
|
this.context = context;
|
2014-08-13 15:16:45 +00:00
|
|
|
|
InitializeComponent();
|
2016-03-28 02:09:57 +00:00
|
|
|
|
_settings = settings;
|
2016-08-19 19:34:20 +00:00
|
|
|
|
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.ProgramSuffixes);
|
2014-08-13 15:16:45 +00:00
|
|
|
|
}
|
2021-11-27 22:37:08 +00:00
|
|
|
|
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Close();
|
|
|
|
|
|
}
|
2014-08-14 11:45:48 +00:00
|
|
|
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
2014-08-13 15:16:45 +00:00
|
|
|
|
{
|
2021-07-04 12:05:37 +00:00
|
|
|
|
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
|
|
|
|
|
|
if (suffixes.Length == 0)
|
2014-08-14 11:45:48 +00:00
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
|
2015-01-06 15:24:11 +00:00
|
|
|
|
MessageBox.Show(warning);
|
2014-08-14 11:45:48 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2014-08-13 15:16:45 +00:00
|
|
|
|
|
2021-07-04 12:05:37 +00:00
|
|
|
|
_settings.ProgramSuffixes = suffixes;
|
|
|
|
|
|
|
2020-04-21 12:54:41 +00:00
|
|
|
|
string msg = context.API.GetTranslation("flowlauncher_plugin_program_update_file_suffixes");
|
2015-01-06 15:24:11 +00:00
|
|
|
|
MessageBox.Show(msg);
|
2019-08-25 07:40:59 +00:00
|
|
|
|
|
|
|
|
|
|
DialogResult = true;
|
2014-08-13 15:16:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-22 09:02:20 +00:00
|
|
|
|
}
|