in src/PortingAssistantExtensionClientShared/Commands/ProjectPortingCommand.cs [99:133]
private async void Execute(object sender, EventArgs e)
{
try
{
if (!await CommandsCommon.CheckLanguageServerStatusAsync()) return;
if (!CommandsCommon.SetupPage()) return;
string SelectedProjectPath = SolutionUtils.GetSelectedProjectPath();
selectedProjectName = Path.GetFileName(SelectedProjectPath);
if (!UserSettings.Instance.SolutionAssessed)
{
NotificationUtils.ShowInfoMessageBox(this.package, "Please run a full assessment before porting", "");
return;
}
if (string.IsNullOrEmpty(SelectedProjectPath))
{
NotificationUtils.ShowInfoMessageBox(this.package, "Please select or open a project", "Porting a project");
return;
}
if (UserSettings.Instance.TargetFramework.Equals(TargetFrameworkType.NO_SELECTION))
{
if (!SelectTargetDialog.EnsureExecute()) return;
}
if (!PortingDialog.EnsureExecute(selectedProjectName)) return;
string SolutionFile = await CommandsCommon.GetSolutionPathAsync();
CommandsCommon.EnableAllCommand(false);
string pipeName = Guid.NewGuid().ToString();
CommandsCommon.RunPortingAsync(SolutionFile, new List<string> { SelectedProjectPath }, pipeName, selectedProjectName);
PipeUtils.StartListenerConnection(pipeName, GetPortingCompletionTasks(this.package, selectedProjectName, UserSettings.Instance.TargetFramework));
}
catch (Exception ex)
{
NotificationUtils.ShowErrorMessageBox(this.package, $"Porting failed for {selectedProjectName} due to {ex.Message}", "Porting failed");
CommandsCommon.EnableAllCommand(true);
}
}