refactor(ui): harden context menu event handling and simplify bindings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,8 +74,6 @@ public partial class TaskListViewModel : ViewModelBase
|
|||||||
[RelayCommand(CanExecute = nameof(CanAddTask))]
|
[RelayCommand(CanExecute = nameof(CanAddTask))]
|
||||||
private async Task AddTask()
|
private async Task AddTask()
|
||||||
{
|
{
|
||||||
if (CurrentListId is null) return;
|
|
||||||
|
|
||||||
// Get list default commit type
|
// Get list default commit type
|
||||||
var list = await _listRepo.GetByIdAsync(CurrentListId);
|
var list = await _listRepo.GetByIdAsync(CurrentListId);
|
||||||
var defaultCommitType = list?.DefaultCommitType ?? "chore";
|
var defaultCommitType = list?.DefaultCommitType ?? "chore";
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public partial class MainWindow : Window
|
|||||||
&& DataContext is MainWindowViewModel vm)
|
&& DataContext is MainWindowViewModel vm)
|
||||||
{
|
{
|
||||||
vm.SelectedList = item;
|
vm.SelectedList = item;
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
xmlns:vm="using:ClaudeDo.Ui.ViewModels"
|
xmlns:vm="using:ClaudeDo.Ui.ViewModels"
|
||||||
xmlns:conv="using:ClaudeDo.Ui.Converters"
|
xmlns:conv="using:ClaudeDo.Ui.Converters"
|
||||||
x:Class="ClaudeDo.Ui.Views.TaskListView"
|
x:Class="ClaudeDo.Ui.Views.TaskListView"
|
||||||
x:DataType="vm:TaskListViewModel">
|
x:DataType="vm:TaskListViewModel"
|
||||||
|
x:Name="Root">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4">
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4">
|
||||||
<TextBlock Text="Tasks" FontWeight="Bold" FontSize="14" VerticalAlignment="Center" Margin="4,0"/>
|
<TextBlock Text="Tasks" FontWeight="Bold" FontSize="14" VerticalAlignment="Center" Margin="4,0"/>
|
||||||
@@ -22,9 +23,9 @@
|
|||||||
<Grid.ContextFlyout>
|
<Grid.ContextFlyout>
|
||||||
<MenuFlyout>
|
<MenuFlyout>
|
||||||
<MenuItem Header="Edit"
|
<MenuItem Header="Edit"
|
||||||
Command="{Binding $parent[UserControl].((vm:TaskListViewModel)DataContext).EditTaskCommand}"/>
|
Command="{Binding #Root.((vm:TaskListViewModel)DataContext).EditTaskCommand}"/>
|
||||||
<MenuItem Header="Delete"
|
<MenuItem Header="Delete"
|
||||||
Command="{Binding $parent[UserControl].((vm:TaskListViewModel)DataContext).DeleteTaskCommand}"/>
|
Command="{Binding #Root.((vm:TaskListViewModel)DataContext).DeleteTaskCommand}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="Run Now"
|
<MenuItem Header="Run Now"
|
||||||
Command="{Binding RunNowCommand}"/>
|
Command="{Binding RunNowCommand}"/>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public partial class TaskListView : UserControl
|
|||||||
&& DataContext is TaskListViewModel vm)
|
&& DataContext is TaskListViewModel vm)
|
||||||
{
|
{
|
||||||
vm.SelectedTask = item;
|
vm.SelectedTask = item;
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user