public ReturnPackageMainWindowViewModel(ReturnFilesViewModel returnFilesViewModel, CellViewModel cellViewModel, ReturnPackageMainWindow window)
 {
     _returnFilesViewModel = returnFilesViewModel;
     _cellViewModel        = cellViewModel;
     _returnService        = new ReturnPackageService();
     _window = window;
 }
Exemple #2
0
        protected override void Execute()
        {
            _messageBoxService = new MessageBoxService();
            Utils.EnsureApplicationResources();

            var returnService = new ReturnPackageService();
            var returnPackage = returnService.GetReturnPackage();

            if (!string.IsNullOrEmpty(returnPackage?.Item2))
            {
                _messageBoxService.ShowWarningMessage(returnPackage.Item2, "Warning");
            }
            else if (returnPackage?.Item1?.FileBasedProject != null && returnPackage?.Item1?.TargetFiles.Count > 0)
            {
                var xliffFiles = returnPackage?.Item1?.TargetFiles?.Any(file => file.Name.EndsWith(".sdlxliff"));
                if (xliffFiles.Value)
                {
                    var window = new ReturnPackageMainWindow(returnPackage?.Item1);
                    window.ShowDialog();
                }
                else
                {
                    _messageBoxService.ShowWarningMessage("The target file(s) has already been returned. In order to repeat the process, you need to revert to .sdlxliff(s) from the Files view.", "Warning");
                }
            }
        }
Exemple #3
0
 public ReturnPackageMainWindowViewModel(ReturnFilesViewModel returnFilesViewModel, CellViewModel cellViewModel, IMessageBoxService messageBoxService)
 {
     _messageBoxService    = messageBoxService;
     _returnFilesViewModel = returnFilesViewModel;
     _cellViewModel        = cellViewModel;
     _returnService        = new ReturnPackageService();
 }
Exemple #4
0
        protected override void Execute()
        {
            EnsureApplicationResources();
            var returnService = new ReturnPackageService();
            var returnPackage = returnService.GetReturnPackage();

            if (returnPackage.Item2 != string.Empty)
            {
                System.Windows.Forms.MessageBox.Show(returnPackage.Item2, @"Warning",
                                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                ReturnPackageMainWindow window = new ReturnPackageMainWindow(returnPackage.Item1);
                window.ShowDialog();
            }
        }
        protected override void Execute()
        {
            _messageBoxService = new MessageBoxService();
            Utils.EnsureApplicationResources();

            var returnService = new ReturnPackageService();
            var returnPackage = returnService.GetReturnPackage();

            if (!string.IsNullOrEmpty(returnPackage?.Item2))
            {
                _messageBoxService.ShowWarningMessage(returnPackage.Item2, "Warning");
            }
            else
            {
                var window = new ReturnPackageMainWindow(returnPackage?.Item1);
                window.ShowDialog();
            }
        }
Exemple #6
0
        protected override void Execute()
        {
            _messageBoxService         = new MessageBoxService();
            _projectsController        = SdlTradosStudio.Application?.GetController <ProjectsController>();
            _projectsControllerService = new ProjectsControllerService(_projectsController);
            var returnService = new ReturnPackageService(_projectsControllerService);
            var dialogService = new DialogService();

            var returnPackage = returnService.GetPackage();

            if (returnPackage.Item1 is null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(returnPackage.Item2))
            {
                _messageBoxService.ShowWarningMessage(returnPackage.Item2, "Warning");
            }
            else if (returnPackage.Item1.FileBasedProject != null && returnPackage.Item1.TargetFiles.Count > 0)
            {
                var xliffFiles = returnPackage.Item1.TargetFiles?.Any(file => file.Name.EndsWith(".sdlxliff"));

                if (xliffFiles.Value)
                {
                    using (var returnPackageWindow = new ReturnPackageWindow(_eventAggregatorService))
                    {
                        var returnViewModel =
                            new ReturnPackageWindowViewModel(returnPackage.Item1, returnService, dialogService, _eventAggregatorService);
                        returnPackageWindow.DataContext = returnViewModel;
                        returnPackageWindow.ShowDialog();
                    }
                }
                else
                {
                    _messageBoxService.ShowWarningMessage("The target file(s) has already been returned. In order to repeat the process, you need to revert to .sdlxliff(s) from the Files view.", "Warning");
                }
            }
        }