- Phase 2: MainWindow 3-section layout (sidebar/content/log bar), Dark/Light theme with ThemeHelper, MainViewModel with ObservableProperty/RelayCommand, tool card filtering by search + category - Phase 3: ToolEditWindow for add/edit tools, ProcessExecutionService (Process.Start + error handling), double-click + right-click context menu (run/edit), path browse dialog - Bugfix: ContextMenu commands now use PlacementTarget.Tag binding (ContextMenu in separate visual tree) - Bugfix: StaticResource converters moved to XAML before DataTemplate to fix XamlParseException on tool card render - Bugfix: Pure filenames (no path separators) treated as PATH commands, not marked invalid - Bugfix: RefreshData preserves SelectedCategory; Load() catches all exceptions; Save() wrapped in try-catch; auto-scroll log to newest entry - Tests: xUnit project with 55 tests covering models, services, converters, and view models
22 lines
526 B
C#
22 lines
526 B
C#
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;
|
|
}
|
|
}
|