public void Check(IEnumerable <ConversionProfile> profiles)
        {
            if (profiles == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var settingsConversionProfile in profiles)
            {
                var orderCopy = settingsConversionProfile.ActionOrder.ToList();
                foreach (var entry in orderCopy)
                {
                    var type = _allowedTypes.FirstOrDefault(x => x.Name == entry);
                    if (type == null || !typeof(IProfileSetting).IsAssignableFrom(type))
                    {
                        settingsConversionProfile.ActionOrder.Remove(entry);
                    }
                }

                var list = new List <string>();
                CheckAllChildSettings(list, settingsConversionProfile);
                CheckSingleSetting(list, settingsConversionProfile.PdfSettings.Security);
                CheckSingleSetting(list, settingsConversionProfile.PdfSettings.Signature);
                var hasCorruptOrder = _actionOrderHelper.HasCorruptOrder(settingsConversionProfile);

                if (list.Count != settingsConversionProfile.ActionOrder.Count || hasCorruptOrder)
                {
                    settingsConversionProfile.ActionOrder = list;
                    _actionOrderHelper.ForceDefaultOrder(settingsConversionProfile);
                }
            }
        }
        private void AddMissingActiveActions(List <string> targetActionOrderList, List <string> enabledActionsList)
        {
            if (enabledActionsList.Count == targetActionOrderList.Count)
            {
                return;
            }

            var missingActions = enabledActionsList.Except(targetActionOrderList).ToList();

            _actionOrderHelper.ForceDefaultOrder(missingActions);
            targetActionOrderList.AddRange(missingActions);
        }
Exemple #3
0
        private ConversionProfile CreateSecuredPdfProfile()
        {
            var profile = new ConversionProfile();

            profile.Name = "Secured PDF";
            profile.Guid = ProfileGuids.SECURED_PDF_PROFILE_GUID;

            profile.OutputFormat = OutputFormat.Pdf;
            _actionOrderHelper.ForceDefaultOrder(profile);
            profile.PdfSettings.Security.Enabled             = true;
            profile.PdfSettings.Security.EncryptionLevel     = EncryptionLevel.Aes256Bit;
            profile.PdfSettings.Security.RequireUserPassword = true;

            profile.PdfSettings.Security.AllowToCopyContent     = false;
            profile.PdfSettings.Security.AllowPrinting          = false;
            profile.PdfSettings.Security.AllowScreenReader      = false;
            profile.PdfSettings.Security.AllowToEditAssembly    = false;
            profile.PdfSettings.Security.AllowToEditTheDocument = false;
            profile.PdfSettings.Security.AllowToFillForms       = false;

            SetDefaultProperties(profile, true);
            return(profile);
        }
Exemple #4
0
        public override async Task ExecuteAsync(object parameter)
        {
            _isExecuting = true;
            try
            {
                if (_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor)
                {
                    var messageText        = Translation.WarningLayoutSwitchCopy + Environment.NewLine + Translation.WantToContinue;
                    var messageInteraction = new MessageInteraction(messageText, Translation.WarningLayoutSwitchTitle, MessageOptions.YesNo, MessageIcon.Warning);
                    var interaction        = await _interactionRequest.RaiseAsync(messageInteraction);

                    if (interaction.Response != MessageResponse.Yes)
                    {
                        return;
                    }
                }
                //switch state
                _currentSettingsProvider.SelectedProfile.EnableWorkflowEditor = !_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor;

                foreach (var conversionProfile in _profiles.Settings)
                {
                    _actionOrderHelper.ForceDefaultOrder(conversionProfile);
                }

                if (_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor)
                {
                    _regionManager.RequestNavigate(RegionNames.ProfileLayoutRegion, nameof(WorkflowEditorView));
                }
                else
                {
                    _regionManager.RequestNavigate(RegionNames.ProfileLayoutRegion, nameof(TabBasedProfileLayoutView));
                }
                _eventAggregator.GetEvent <SwitchWorkflowLayoutEvent>().Publish();
            }
            finally
            {
                _isExecuting = false;
            }
        }
Exemple #5
0
        public async void Execute(object parameter)
        {
            var actionFacade = (IPresenterActionFacade)parameter;
            var profile      = _selectedProfileProvider.SelectedProfile;

            if (!profile.ActionOrder.Exists(x => x == actionFacade.SettingsType.Name))
            {
                if (!_editionHelper.IsFreeEdition || !typeof(IBusinessFeatureAction).IsAssignableFrom(actionFacade.Action))
                {
                    actionFacade.IsEnabled = true;
                    profile.ActionOrder.Add(actionFacade.SettingsType.Name);
                }

                _actionOrderHelper.EnsureEncryptionAndSignatureOrder(profile);

                if (profile.EnableWorkflowEditor)
                {
                    var result = await _interactionRequest.RaiseAsync(new WorkflowEditorOverlayInteraction(false, actionFacade.Translation, actionFacade.OverlayView));

                    if (!result.Success)
                    {
                        actionFacade.IsEnabled = false;
                        _selectedProfileProvider.SelectedProfile.ActionOrder.RemoveAll(x => x == actionFacade.SettingsType.Name);

                        if ("CoverPage" == actionFacade.SettingsType.Name)
                        {
                            _selectedProfileProvider.SelectedProfile.CoverPage.File = string.Empty;
                        }
                    }
                }
                else
                {
                    _actionOrderHelper.ForceDefaultOrder(profile);
                }

                _eventAggregator.GetEvent <ActionAddedToWorkflowEvent>().Publish();
            }
        }