Flow.Launcher/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs
2021-09-23 13:32:10 -05:00

51 lines
No EOL
1.5 KiB
C#

using Flow.Launcher.Plugin.BrowserBookmark.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
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
{
Name = browser.Name, DataDirectoryPath = browser.DataDirectoryPath
};
}
private void ConfirmEditCustomBrowser(object sender, RoutedEventArgs e)
{
if (DataContext is CustomBrowser editedBrowser)
{
currentCustomBrowser.Name = editedBrowser.Name;
currentCustomBrowser.DataDirectoryPath = editedBrowser.DataDirectoryPath;
}
Close();
}
private void WindowKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ConfirmEditCustomBrowser(sender, e);
}
}
}
}