コード例 #1
0
        public ProfilesViewModel(
            ISelectedProfileProvider selectedProfileProvider,
            ITranslationUpdater translationUpdater,
            ICommandLocator commandLocator,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profileProvider,
            IGpoSettings gpoSettings,
            IRegionManager regionManager,
            IWorkflowEditorSubViewProvider viewProvider,
            ICommandBuilderProvider commandBuilderProvider)
            : base(translationUpdater)
        {
            _profileProvider = profileProvider;
            _regionManager   = regionManager;
            _viewProvider    = viewProvider;

            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();

            var macroCommandBuilder = commandBuilderProvider.ProvideBuilder(commandLocator);

            ProfileAddCommand = macroCommandBuilder
                                .AddCommand <ProfileAddCommand>()
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.OutputFormatOverlay, t => t.OutputFormat))
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.SaveOverlay, t => t.Save))
                                .Build();
        }
コード例 #2
0
        public WorkflowEditorViewModel(ISelectedProfileProvider selectedProfileProvider,
                                       ITranslationUpdater translationUpdater,
                                       IEnumerable <IActionFacade> actionFacades,
                                       IInteractionRequest interactionRequest,
                                       IEventAggregator eventAggregator,
                                       ICommandLocator commandLocator,
                                       IWorkflowEditorSubViewProvider viewProvider,
                                       ICommandBuilderProvider commandBuilderProvider,
                                       IDispatcher dispatcher
                                       ) : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            _interactionRequest = interactionRequest;
            _eventAggregator    = eventAggregator;
            _commandLocator     = commandLocator;

            ActionFacades = actionFacades;

            RemoveActionCommand          = new DelegateCommand(ExecuteRemoveAction);
            EditActionCommand            = new DelegateCommand(ExecuteEditAction);
            OpenAddActionOverviewCommand = new DelegateCommand(OpenAddActionOverview);

            var UpdateSettingsPreviewsCommand = new DelegateCommand(o => UpdateSettingsPreviews());

            SetMetaDataCommand = commandBuilderProvider.ProvideBuilder(_commandLocator)
                                 .AddInitializedCommand <WorkflowEditorCommand>(c => c.Initialize(viewProvider.MetaDataOverlay, t => t.MetaData))
                                 .AddCommand(UpdateSettingsPreviewsCommand)
                                 .Build();

            SetSaveCommand = commandBuilderProvider.ProvideBuilder(_commandLocator)
                             .AddInitializedCommand <WorkflowEditorCommand>(c => c.Initialize(viewProvider.SaveOverlay, t => t.Save))
                             .AddCommand(UpdateSettingsPreviewsCommand)
                             .Build();

            SetOutputFormatCommand = commandBuilderProvider.ProvideBuilder(_commandLocator)
                                     .AddInitializedCommand <WorkflowEditorCommand>(c => c.Initialize(viewProvider.OutputFormatOverlay, t => t.OutputFormat))
                                     .AddCommand(UpdateSettingsPreviewsCommand)
                                     .Build();

            SetPrinterCommand = commandBuilderProvider.ProvideBuilder(_commandLocator)
                                .AddInitializedCommand <WorkflowEditorCommand>(c => c.Initialize((viewProvider as ServerWorkflowEditorSubViewProvider)?.PrinterOverlay, t => t.Printer))
                                .Build();

            PreparationDropTarget   = new WorkflowEditorActionDropTargetHandler <IPreConversionAction>();
            ModifyDropTarget        = new WorkflowEditorActionDropTargetHandler <IConversionAction>();
            ModifyDragSourceHandler = new WorkflowEditorActionDragSourceHandler(obj =>
            {
                var facade           = (IActionFacade)obj;
                var isAssignableFrom = typeof(IFixedOrderAction).IsAssignableFrom(facade.SettingsType);
                return(!isAssignableFrom);
            });

            SendDropTarget = new WorkflowEditorActionDropTargetHandler <IPostConversionAction>();

            selectedProfileProvider.SelectedProfileChanged += SelectedProfileOnPropertyChanged;

            eventAggregator.GetEvent <WorkflowSettingsChanged>().Subscribe(() =>
            {
                GenerateCollectionViewsOfActions();
                UpdateSettingsPreviews();
            });
        }