public async void Execute(object parameter)
        {
            var actionFacade = (IPresenterActionFacade)parameter;
            var profile      = _selectedProfileProvider.SelectedProfile;

            if (!profile.ActionOrder.Exists(x => x == actionFacade.SettingsType.Name))
            {
                var isDisabled = false;
                if (IsSupported(actionFacade))
                {
                    actionFacade.IsEnabled = true;
                    profile.ActionOrder.Add(actionFacade.SettingsType.Name);
                }
                else
                {
                    isDisabled = true;
                }

                _actionOrderHelper.EnsureEncryptionAndSignatureOrder(profile);

                var interaction = await _interactionRequest.RaiseAsync(new WorkflowEditorOverlayInteraction(actionFacade.Translation, actionFacade.OverlayView, isDisabled, true));

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

                    if ("CoverPage" == actionFacade.SettingsType.Name)
                    {
                        _selectedProfileProvider.SelectedProfile.CoverPage.Files = new List <string>();
                    }
                }

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

                if (interaction.Result == WorkflowEditorOverlayResult.Back)
                {
                    await _interactionRequest.RaiseAsync(new AddActionOverlayInteraction());
                }
            }
        }
Exemple #2
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();
            }
        }
        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 enabledActionsList = GetListOfActiveActions(settingsConversionProfile);

                // get an action ordered list with only distinct and enabled actions
                var actionOrderList = settingsConversionProfile
                                      .ActionOrder
                                      .Distinct()
                                      .Where(s => enabledActionsList.Contains(s))
                                      .ToList();

                AddMissingActiveActions(actionOrderList, enabledActionsList);
                UpdateActionOrderList(settingsConversionProfile, actionOrderList);

                if (_actionOrderHelper.HasCorruptOrder(settingsConversionProfile))
                {
                    _actionOrderHelper.EnsureEncryptionAndSignatureOrder(settingsConversionProfile);
                }
            }
        }