Flow.Launcher/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs

51 lines
1.6 KiB
C#
Raw Normal View History

using Flow.Launcher.Plugin.BrowserBookmark.Models;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Flow.Launcher.Plugin.BrowserBookmark.Views
{
/// <summary>
/// Interaction logic for CustomBrowserSetting.xaml
/// </summary>
public partial class CustomBrowserSettingWindow : Window
{
private CustomBrowser currentCustomBrowser;
public CustomBrowserSettingWindow(CustomBrowser browser)
{
InitializeComponent();
currentCustomBrowser = browser;
DataContext = new CustomBrowser
{
2023-02-03 09:07:33 +00:00
Name = browser.Name,
DataDirectoryPath = browser.DataDirectoryPath,
BrowserType = browser.BrowserType,
};
}
private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e)
{
if (DataContext is CustomBrowser editBrowser && e.Source is Button button)
{
if (button.Name == "btnConfirm")
{
currentCustomBrowser.Name = editBrowser.Name;
currentCustomBrowser.DataDirectoryPath = editBrowser.DataDirectoryPath;
2023-02-03 09:07:33 +00:00
currentCustomBrowser.BrowserType = editBrowser.BrowserType;
Close();
}
}
Close();
}
2021-09-23 18:32:10 +00:00
private void WindowKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ConfirmCancelEditCustomBrowser(sender, e);
2021-09-23 18:32:10 +00:00
}
}
}
2023-02-03 09:07:33 +00:00
}