Flow.Launcher/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2016-08-19 22:24:21 +00:00
using System.Windows;
2022-12-06 12:34:40 +00:00
using Flow.Launcher.Plugin.Program.ViewModels;
2020-04-21 09:12:17 +00:00
namespace Flow.Launcher.Plugin.Program
{
/// <summary>
/// Interaction logic for AddProgramSource.xaml
/// </summary>
public partial class AddProgramSource : Window
{
2022-12-06 12:34:40 +00:00
private readonly AddProgramSourceViewModel ViewModel;
2022-12-06 12:34:40 +00:00
public AddProgramSource(AddProgramSourceViewModel viewModel)
{
2022-12-06 12:34:40 +00:00
ViewModel = viewModel;
DataContext = viewModel;
InitializeComponent();
2015-05-02 14:17:42 +00:00
}
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
2022-12-06 12:34:40 +00:00
ViewModel.Browse();
}
2021-11-27 22:37:08 +00:00
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
{
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
{
2022-12-06 14:54:12 +00:00
MessageBox.Show(msg); // Invalid
return;
2015-05-02 14:17:42 +00:00
}
2022-12-06 14:54:12 +00:00
DialogResult = modified;
Close();
}
}
}