pass context to menu

This commit is contained in:
Matt Parker
2025-08-03 02:12:53 +10:00
parent 6f39261cae
commit 671586fbba

View File

@@ -53,8 +53,9 @@
await SelectedFileChanged.InvokeAsync(file); await SelectedFileChanged.InvokeAsync(file);
} }
private async Task OpenProjectContextMenu(MouseEventArgs args) private async Task OpenProjectContextMenu(MouseEventArgs args, SharpIdeProjectModel project)
{ {
Console.WriteLine($"Opening context menu for project: {project.Name}");
await _contextMenuRef.OpenMenuAsync(args); await _contextMenuRef.OpenMenuAsync(args);
} }
@@ -81,7 +82,7 @@
private RenderFragment GetProjectFragment(SharpIdeProjectModel project) => private RenderFragment GetProjectFragment(SharpIdeProjectModel project) =>
@<text> @<text>
<div @onclick="@OpenProjectContextMenu" @oncontextmenu="@OpenProjectContextMenu" @oncontextmenu:preventDefault @oncontextmenu:stopPropagation> <div @onclick="@(async s => await OpenProjectContextMenu(s, project))" @oncontextmenu="@(async s => await OpenProjectContextMenu(s, project))" @oncontextmenu:preventDefault @oncontextmenu:stopPropagation>
<MudTreeViewItem T="ISharpIdeNode" TextTypo="Typo.body2" Icon="@Icons.Custom.FileFormats.FileCode" IconColor="Color.Success" Text="@project.Name" Value="project" @bind-Expanded="@project.Expanded"> <MudTreeViewItem T="ISharpIdeNode" TextTypo="Typo.body2" Icon="@Icons.Custom.FileFormats.FileCode" IconColor="Color.Success" Text="@project.Name" Value="project" @bind-Expanded="@project.Expanded">
@if (project.Expanded) @if (project.Expanded)
{ {