using System.Windows;
using PersonalToolBox.ViewModels;

namespace PersonalToolBox.Views;

public partial class ToolEditWindow : Window
{
    public ToolEditWindow(ToolEditViewModel viewModel)
    {
        InitializeComponent();

        viewModel.CloseAction = (result) =>
        {
            // DialogResult 会自动关闭由 ShowDialog() 显示的窗口，无需显式调用 Close()
            DialogResult = result;
        };

        Owner = Application.Current.MainWindow;
        DataContext = viewModel;
    }
}
