示例#1
0
        protected override void Execute()
        {
            // set the default settings for creating the xliff from the sdlxliff
            // these should not be taken from the users settings
            var settings = GetSettings();

            settings.ExportOptions.CopySourceToTarget  = false;
            settings.ExportOptions.IncludeTranslations = true;
            settings.ExportOptions.ExcludeFilterIds    = new List <string>();

            settings.ImportOptions.StatusTranslationUpdatedId    = "Translated";
            settings.ImportOptions.StatusSegmentNotImportedId    = string.Empty;
            settings.ImportOptions.StatusTranslationNotUpdatedId = string.Empty;
            settings.ImportOptions.OverwriteTranslations         = true;

            var wizardService = new WizardService(Enumerators.Action.Convert, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, settings, _dialogService, _languageProvider,
                                                  _projectAutomationService);

            var wizardContext = wizardService.ShowWizard(_controllers.ProjectsController, out var message);

            if (wizardContext == null && !string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            _controllers.TranscreateController.UpdateProjectData(wizardContext);
        }
示例#2
0
        protected override void Execute()
        {
            var selectedProject = _controllers.TranscreateController.GetSelectedProjects()?.FirstOrDefault();

            if (selectedProject == null)
            {
                return;
            }

            var documents = _controllers.EditorController.GetDocuments()?.ToList();

            if (documents != null && documents.Count > 0)
            {
                var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct();
                if (documentProjectIds.Any(a => a == selectedProject.Id))
                {
                    MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }

            var action = selectedProject is BackTranslationProject
                                ? Enumerators.Action.ExportBackTranslation
                                : Enumerators.Action.Export;

            var workFlow = Enumerators.WorkFlow.External;

            var settings      = GetSettings();
            var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, settings, _dialogService,
                                                  _projectAutomationService, _projectSettingsService);

            var taskContext = wizardService.ShowWizard(Controller, out var message);

            if (taskContext == null && !string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            if (selectedProject is BackTranslationProject)
            {
                var projects      = _controllers.TranscreateController.GetProjects();
                var parentProject = projects.FirstOrDefault(project => project.BackTranslationProjects.Exists(a => a.Id == selectedProject.Id));

                _controllers.TranscreateController.UpdateBackTranslationProjectData(parentProject?.Id, taskContext);
            }
            else
            {
                _controllers.TranscreateController.UpdateProjectData(taskContext);
            }
        }
        protected override void Execute()
        {
            var wizardService = new WizardService(Enumerators.Action.Export, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, GetSettings(), _dialogService, _languageProvider);

            var wizardContext = wizardService.ShowWizard(_controllers.FilesController, out var message);

            if (wizardContext == null && !string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, PluginResources.XLIFFManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            _controllers.XliffManagerController.UpdateProjectData(wizardContext);
        }
示例#4
0
        protected override void Execute()
        {
            //if (!_controllers.TranscreateController.IsActive)
            //{
            //	return;
            //}

            var selectedProject = _controllers.TranscreateController.GetSelectedProjects()?.FirstOrDefault();

            if (selectedProject == null)
            {
                return;
            }

            var action = selectedProject is BackTranslationProject
                                ? Enumerators.Action.ImportBackTranslation
                                : Enumerators.Action.Import;
            var workFlow = Enumerators.WorkFlow.External;

            var settings      = GetSettings();
            var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, settings, _dialogService,
                                                  _projectAutomationService);

            var taskContext = wizardService.ShowWizard(_controllers.TranscreateController, out var message);

            if (taskContext == null && !string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            if (selectedProject is BackTranslationProject)
            {
                var projects      = _controllers.TranscreateController.GetProjects();
                var parentProject = projects.FirstOrDefault(project => project.BackTranslationProjects.Exists(a => a.Id == selectedProject.Id));

                _controllers.TranscreateController.UpdateBackTranslationProjectData(parentProject, taskContext);
            }
            else
            {
                _controllers.TranscreateController.UpdateProjectData(taskContext);
            }
        }
示例#5
0
        public WizardForm()
        {
            InitializeComponent();

            this.exit.Click    += new EventHandler(exit_Click);
            this.next.Click    += new EventHandler(next_Click);
            this.back.Click    += new EventHandler(back_Click);
            this.restart.Click += new EventHandler(restart_Click);

            RootWorkItem.Workspaces.Add(this.wizardWorkspace);

            // set these manually becasue Property Injection will be too late (we need to use them in the ctor)
            Presenter     = RootWorkItem.Services.Get <WizardPresenter>();
            WizardService = RootWorkItem.Services.Get <WizardService>();

            this.next.DataBindings.Add("Enabled", Presenter, "ForwardAllowed");
            this.back.DataBindings.Add("Enabled", Presenter, "BackwardAllowed");
            this.restart.DataBindings.Add("Enabled", Presenter, "RestartAllowed");

            WizardService.Workspace = wizardWorkspace;
            WizardService.Start();
        }
示例#6
0
        protected override void Execute()
        {
            var projects = _controllers.TranscreateController.GetSelectedProjects();

            if (projects?.Count != 1)
            {
                Enabled = false;
                return;
            }

            var project = projects[0];

            if (project is BackTranslationProject)
            {
                return;
            }

            var studioProject = _controllers.ProjectsController.GetProjects()
                                .FirstOrDefault(a => a.GetProjectInfo().Id.ToString() == project.Id);

            if (studioProject == null)
            {
                return;
            }

            var documents = _controllers.EditorController.GetDocuments()?.ToList();

            if (documents != null && documents.Count > 0)
            {
                var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct();
                if (documentProjectIds.Any(a => a == project.Id))
                {
                    MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }

            var action   = Enumerators.Action.CreateBackTranslation;
            var workFlow = Enumerators.WorkFlow.Internal;

            var settings = GetSettings();

            settings.ExportOptions.IncludeBackTranslations = true;
            settings.ExportOptions.IncludeTranslations     = true;
            settings.ExportOptions.CopySourceToTarget      = false;

            settings.ImportOptions.OverwriteTranslations      = true;
            settings.ImportOptions.OriginSystem               = Constants.OriginSystem_TranscreateAutomation;
            settings.ImportOptions.StatusTranslationUpdatedId = string.Empty;

            var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, settings, _dialogService,
                                                  _projectAutomationService, _projectSettingsService);

            try
            {
                _controllers.TranscreateController.IgnoreProjectChanged = true;

                var taskContext = wizardService.ShowWizard(Controller, out var message);
                if (taskContext == null && !string.IsNullOrEmpty(message))
                {
                    LogManager.GetCurrentClassLogger().Warn(message);
                    MessageBox.Show(message,
                                    PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                LogManager.GetCurrentClassLogger().Error(ex);
                MessageBox.Show(ex.Message,
                                PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
            }
            finally
            {
                _controllers.TranscreateController.IgnoreProjectChanged = false;
            }
        }
        protected override void Execute()
        {
            var selectedProject = _controllers.ProjectsController.SelectedProjects.FirstOrDefault();

            if (selectedProject == null)
            {
                return;
            }

            var documents = _controllers.EditorController.GetDocuments()?.ToList();

            if (documents != null && documents.Count > 0)
            {
                var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct();
                if (documentProjectIds.Any(a => a == selectedProject.GetProjectInfo().Id.ToString()))
                {
                    MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }

            // set the default settings for creating the xliff from the sdlxliff
            // these should not be taken from the users settings
            var settings = GetSettings();

            settings.ExportOptions.CopySourceToTarget  = false;
            settings.ExportOptions.IncludeTranslations = true;
            settings.ExportOptions.ExcludeFilterIds    = new List <string>();

            settings.ImportOptions.StatusTranslationUpdatedId    = string.Empty;
            settings.ImportOptions.StatusSegmentNotImportedId    = string.Empty;
            settings.ImportOptions.StatusTranslationNotUpdatedId = string.Empty;
            settings.ImportOptions.OverwriteTranslations         = true;

            var action   = Enumerators.Action.Convert;
            var workFlow = Enumerators.WorkFlow.Internal;


            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;
            }

            if (selectedProject.GetProjectInfo().ProjectOrigin == Constants.ProjectOrigin_TranscreateProject)
            {
                MessageBox.Show(PluginResources.Warning_Message_ProjectAlreadyTranscreateProject,
                                PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider,
                                                  _imageService, _controllers, _segmentBuilder, settings, _dialogService,
                                                  _projectAutomationService, _projectSettingsService);

            var taskContext = wizardService.ShowWizard(_controllers.ProjectsController, out var message);

            if (taskContext == null && !string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            _controllers.TranscreateController.UpdateProjectData(taskContext);
        }
示例#8
0
 public void GoBack()
 {
     WizardService.Back();
 }