Skip to content

Commit

Permalink
Add ability to launch DAB from the item context menu (#2651)
Browse files Browse the repository at this point in the history
fixes #2635
  • Loading branch information
ErikEJ authored Nov 24, 2024
1 parent c375ad3 commit 0997bbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GUI/EFCorePowerTools/EFCorePowerToolsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private async void OnReverseEngineerConfigFileMenuBeforeQueryStatus(object sende
menuCommand.Text = ButtonLocale.cmdidReverseEngineerRefresh;
break;
case PkgCmdIDList.cmdidDabStart:
menuCommand.Text = "EF Core Power Tools - Start DAB";
menuCommand.Text = "Start Data API Builder";
break;

default:
Expand Down Expand Up @@ -688,7 +688,7 @@ private async void OnReverseEngineerConfigFileMenuInvokeHandler(object sender, E
return;
}

await VS.MessageBox.ShowConfirmAsync("Launch DAB");
dabBuilderHandler.LaunchDab(item.FullPath);
}
}
catch (Exception ex)
Expand Down
10 changes: 10 additions & 0 deletions src/GUI/Shared/Handlers/DabBuilderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public DabBuilderHandler(EFCorePowerToolsPackage package)
vsDataHelper = new VsDataHelper();
}

public void LaunchDab(string configPath)
{
var path = Path.GetDirectoryName(configPath);

var proc = new Process();
proc.StartInfo.FileName = "cmd";
proc.StartInfo.Arguments = $" /k \"cd /d {path} && dab start\"";
proc.Start();
}

public async System.Threading.Tasks.Task BuildDabConfigAsync(Project project)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
Expand Down

0 comments on commit 0997bbe

Please sign in to comment.