2016-08-19 22:24:21 +00:00
|
|
|
|
using System.Windows;
|
2024-11-25 02:38:43 +00:00
|
|
|
|
using Flow.Launcher.Core;
|
2022-12-06 12:34:40 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Program.ViewModels;
|
2015-04-21 00:32:10 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.Program
|
2015-04-21 00:32:10 +00:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interaction logic for AddProgramSource.xaml
|
|
|
|
|
|
/// </summary>
|
2022-10-18 06:51:13 +00:00
|
|
|
|
public partial class AddProgramSource : Window
|
2015-04-21 00:32:10 +00:00
|
|
|
|
{
|
2022-12-06 12:34:40 +00:00
|
|
|
|
private readonly AddProgramSourceViewModel ViewModel;
|
2015-04-21 00:32:10 +00:00
|
|
|
|
|
2022-12-06 12:34:40 +00:00
|
|
|
|
public AddProgramSource(AddProgramSourceViewModel viewModel)
|
2015-04-21 00:32:10 +00:00
|
|
|
|
{
|
2022-12-06 12:34:40 +00:00
|
|
|
|
ViewModel = viewModel;
|
|
|
|
|
|
DataContext = viewModel;
|
2015-04-21 00:32:10 +00:00
|
|
|
|
InitializeComponent();
|
2015-05-02 14:17:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-04-21 00:32:10 +00:00
|
|
|
|
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2022-12-06 12:34:40 +00:00
|
|
|
|
ViewModel.Browse();
|
2015-04-21 00:32:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-27 22:37:08 +00:00
|
|
|
|
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 06:51:13 +00:00
|
|
|
|
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
|
2015-04-21 00:32:10 +00:00
|
|
|
|
{
|
2022-12-07 06:01:12 +00:00
|
|
|
|
var (modified, msg) = ViewModel.AddOrUpdate();
|
2022-12-06 14:54:12 +00:00
|
|
|
|
if (modified == false && msg != null)
|
2015-05-02 14:17:42 +00:00
|
|
|
|
{
|
2024-11-25 02:38:43 +00:00
|
|
|
|
MessageBoxEx.Show(msg); // Invalid
|
2022-12-06 14:54:12 +00:00
|
|
|
|
return;
|
2015-05-02 14:17:42 +00:00
|
|
|
|
}
|
2022-12-06 14:54:12 +00:00
|
|
|
|
DialogResult = modified;
|
|
|
|
|
|
Close();
|
2015-04-21 00:32:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|