private void Feature_RunAsDistro(object sender, EventArgs e) { var targetItem = GetSelectedDistroBySender(sender); if (targetItem == null) { return; } using var dialog = new RunAsForm(new DistroRunAsRequest() { DistroName = targetItem.DistroName, DistroList = AppContext.WslDistroList.Select(x => x.DistroName).Distinct().ToArray(), User = "******", ExecCommandLine = "", }); if (dialog.ShowDialog() != DialogResult.OK) { return; } var targetDistro = dialog.ViewModel.DistroName; var targetUserId = dialog.ViewModel.User; var execCommandLine = dialog.ViewModel.ExecCommandLine; var process = WslHelpers.CreateLaunchSpecificDistroAsUserProcess( targetDistro, targetUserId, execCommandLine); process.Start(); process.WaitForExit(); AppContext.RefreshDistroList(); }
private void Feature_RunAsDistro(object sender, EventArgs e) { var targetItem = GetSelectedDistroBySender(sender); if (targetItem == null) { return; } using var dialog = new RunAsForm(new DistroRunAsRequest() { DistroName = targetItem.DistroName, DistroList = AppContext.WslDistroList.Select(x => x.DistroName).Distinct().ToArray(), User = "******", ExecCommandLine = "", }); if (dialog.ShowDialog() != DialogResult.OK) { return; } var targetDistro = dialog.ViewModel.DistroName; var targetUserId = dialog.ViewModel.User; var execCommandLine = dialog.ViewModel.ExecCommandLine; // todo }