Skip to content

Commit

Permalink
Included an information message that is presented to the user immedia…
Browse files Browse the repository at this point in the history
…tely after they select the option 'Convert to Transcreate project', informing them that the Transcreate project folder already exists.
  • Loading branch information
Impertatore committed Mar 9, 2021
1 parent f71d88d commit 6936118
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 11 additions & 2 deletions SDLTranscreate/SDLTranscreate/Actions/ConvertProjectAction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
Expand Down Expand Up @@ -53,6 +54,15 @@ protected override void Execute()
var action = Enumerators.Action.Convert;
var workFlow = Enumerators.WorkFlow.Internal;

var selectedProject = _controllers.ProjectsController.SelectedProjects.FirstOrDefault();
var newProjectLocalFolder = selectedProject?.GetProjectInfo().LocalProjectFolder + "-T";
if (Directory.Exists(newProjectLocalFolder))
{
MessageBox.Show(PluginResources.Warning_Message_ProjectFolderAlreadyExists + Environment.NewLine + Environment.NewLine + newProjectLocalFolder,
PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information);
return;
}

var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider,
_imageService, _controllers, _segmentBuilder, settings, _dialogService,
_projectAutomationService, _projectSettingsService);
Expand All @@ -72,7 +82,6 @@ public override void Initialize()
{
Enabled = false;


_controllers = SdlTradosStudio.Application.GetController<TranscreateViewController>().Controllers;
SetProjectsController();
_customerProvider = new CustomerProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private async Task<bool> CreateTranscreateProject(JobProcess jobProcess)
newProjectLocalFolder = selectedProject.GetProjectInfo().LocalProjectFolder + "-T";
if (Directory.Exists(newProjectLocalFolder))
{
throw new Exception(PluginResources.Warning_Message_ProjectFolderAlreadyExists + Environment.NewLine + newProjectLocalFolder);
throw new Exception(PluginResources.Warning_Message_ProjectFolderAlreadyExists + Environment.NewLine + Environment.NewLine + newProjectLocalFolder);
}

var sourceLanguage = TaskContext.Project.SourceLanguage.CultureInfo.Name;
Expand Down Expand Up @@ -441,10 +441,9 @@ private async Task<bool> CreateTranscreateProject(JobProcess jobProcess)
if (_newProject != null)
{
await CloseBackTranslationProject(_newProject);
// cleanup folders
TryDeleteFolder(newProjectLocalFolder);
}

// cleanup folders
TryDeleteFolder(newProjectLocalFolder);
}

return await Task.FromResult(success);
Expand Down

0 comments on commit 6936118

Please sign in to comment.