2025-05-21 04:58:55 +00:00
|
|
|
|
using System.Windows;
|
2021-10-30 18:49:23 +00:00
|
|
|
|
using System.Windows.Controls;
|
2025-05-21 03:59:24 +00:00
|
|
|
|
using System.Windows.Navigation;
|
2025-05-21 04:58:55 +00:00
|
|
|
|
using CommunityToolkit.Mvvm.DependencyInjection;
|
2025-09-18 03:58:38 +00:00
|
|
|
|
using Flow.Launcher.Infrastructure;
|
2025-04-23 04:43:34 +00:00
|
|
|
|
using Flow.Launcher.ViewModel;
|
2021-10-30 18:49:23 +00:00
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher
|
|
|
|
|
|
{
|
2025-04-23 04:43:34 +00:00
|
|
|
|
public partial class SelectFileManagerWindow : Window
|
2021-10-30 18:49:23 +00:00
|
|
|
|
{
|
2025-05-21 04:58:55 +00:00
|
|
|
|
private readonly SelectFileManagerViewModel _viewModel;
|
2021-11-02 20:07:11 +00:00
|
|
|
|
|
2025-05-21 04:58:55 +00:00
|
|
|
|
public SelectFileManagerWindow()
|
2021-11-05 19:16:20 +00:00
|
|
|
|
{
|
2025-05-21 04:58:55 +00:00
|
|
|
|
_viewModel = Ioc.Default.GetRequiredService<SelectFileManagerViewModel>();
|
|
|
|
|
|
DataContext = _viewModel;
|
2021-10-30 18:49:23 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2021-11-05 19:16:20 +00:00
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDone_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2025-05-21 04:58:55 +00:00
|
|
|
|
if (_viewModel.SaveSettings())
|
2025-05-20 09:49:38 +00:00
|
|
|
|
{
|
2025-05-21 04:58:55 +00:00
|
|
|
|
Close();
|
2025-05-20 09:49:38 +00:00
|
|
|
|
}
|
2021-11-05 19:16:20 +00:00
|
|
|
|
}
|
2021-11-06 06:04:37 +00:00
|
|
|
|
|
2021-11-09 23:30:10 +00:00
|
|
|
|
private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2025-09-18 03:58:38 +00:00
|
|
|
|
var selectedFilePath = Win32Helper.SelectFile();
|
2025-05-21 11:30:47 +00:00
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(selectedFilePath))
|
2021-11-09 23:30:10 +00:00
|
|
|
|
{
|
2025-05-21 04:58:55 +00:00
|
|
|
|
var path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
|
2025-05-21 11:30:47 +00:00
|
|
|
|
path.Text = selectedFilePath;
|
2021-11-09 23:30:10 +00:00
|
|
|
|
path.Focus();
|
|
|
|
|
|
((Button)sender).Focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-10-30 18:49:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|