public BlockOutputPreviewViewModel(IItemFilterBlockTranslator itemFilterBlockTranslator) : base("Block Output Preview")
        {
            _itemFilterBlockTranslator = itemFilterBlockTranslator;
            ContentId = ToolContentId;
            var icon = new BitmapImage();

            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/block_output_preview_icon.png");
            icon.EndInit();
            IconSource = icon;

            IsVisible = false;

            Messenger.Default.Register <NotificationMessage>(this, message =>
            {
                switch (message.Notification)
                {
                case "SelectedBlockChanged":
                    {
                        OnSelectedBlockChanged(this, EventArgs.Empty);
                        break;
                    }

                case "ActiveDocumentChanged":
                    {
                        OnSelectedBlockChanged(this, EventArgs.Empty);
                        break;
                    }
                }
            });
        }
        public BlockOutputPreviewViewModel(IItemFilterBlockTranslator itemFilterBlockTranslator)
            : base("Block Output Preview")
        {
            _itemFilterBlockTranslator = itemFilterBlockTranslator;
            ContentId = ToolContentId;
            var icon = new BitmapImage();
            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/block_output_preview_icon.png");
            icon.EndInit();
            IconSource = icon;

            IsVisible = false;

            Messenger.Default.Register<NotificationMessage>(this, message =>
            {
                switch (message.Notification)
                {
                    case "SelectedBlockChanged":
                    {
                        OnSelectedBlockChanged(null, null);
                        break;
                    }
                    case "ActiveDocumentChanged":
                    {
                        OnSelectedBlockChanged(null, null);
                        break;
                    }
                }
            });
        }
Example #3
0
 public ItemFilterScriptTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder,
                                   IItemFilterBlockTranslator blockTranslator,
                                   IItemFilterScriptFactory itemFilterScriptFactory)
 {
     _blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
     _blockTranslator            = blockTranslator;
     _itemFilterScriptFactory    = itemFilterScriptFactory;
 }
Example #4
0
        private ItemFilterScriptTranslator CreateItemFilterScriptTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder = null,
                                                                            IItemFilterBlockTranslator itemFilterBlockTranslator   = null,
                                                                            IItemFilterScriptFactory itemFilterScriptFactory       = null)
        {
            var mockItemFilterScriptFactory = new Mock <IItemFilterScriptFactory>();

            mockItemFilterScriptFactory
            .Setup(i => i.Create())
            .Returns(new ItemFilterScript());

            return(new ItemFilterScriptTranslator(blockGroupHierarchyBuilder ?? new Mock <IBlockGroupHierarchyBuilder>().Object,
                                                  itemFilterBlockTranslator ?? new Mock <IItemFilterBlockTranslator>().Object,
                                                  itemFilterScriptFactory ?? mockItemFilterScriptFactory.Object));
        }
Example #5
0
        public ItemFilterScriptViewModel(IItemFilterBlockBaseViewModelFactory itemFilterBlockBaseViewModelFactory,
                                         IItemFilterBlockTranslator blockTranslator,
                                         IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
                                         IItemFilterPersistenceService persistenceService,
                                         IMessageBoxService messageBoxService,
                                         IClipboardService clipboardService,
                                         IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
        {
            _itemFilterBlockBaseViewModelFactory = itemFilterBlockBaseViewModelFactory;
            _blockTranslator = blockTranslator;
            _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
            _avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
            _persistenceService         = persistenceService;
            _messageBoxService          = messageBoxService;
            _clipboardService           = clipboardService;
            _blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
            _itemFilterBlockViewModels  = new ObservableCollection <IItemFilterBlockViewModelBase>();

            _avalonDockWorkspaceViewModel.ActiveDocumentChanged += (s, e) =>
            {
                RaisePropertyChanged(nameof(IsActiveDocument));
            };

            ToggleShowAdvancedCommand = new RelayCommand <bool>(OnToggleShowAdvancedCommand);
            ClearFilterCommand        = new RelayCommand(OnClearFilterCommand, () => BlockFilterPredicate != null);
            CloseCommand             = new RelayCommand(async() => await OnCloseCommand());
            DeleteBlockCommand       = new RelayCommand(OnDeleteBlockCommand, () => SelectedBlockViewModel != null);
            MoveBlockToTopCommand    = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null && ItemFilterBlockViewModels.IndexOf(SelectedBlockViewModel) > 0);
            MoveBlockUpCommand       = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null && ItemFilterBlockViewModels.IndexOf(SelectedBlockViewModel) > 0);
            MoveBlockDownCommand     = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null && ItemFilterBlockViewModels.IndexOf(SelectedBlockViewModel) < ItemFilterBlockViewModels.Count);
            MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null && ItemFilterBlockViewModels.IndexOf(SelectedBlockViewModel) < ItemFilterBlockViewModels.Count);
            AddBlockCommand          = new RelayCommand(OnAddBlockCommand);
            AddSectionCommand        = new RelayCommand(OnAddCommentBlockCommand, () => SelectedBlockViewModel != null);
            DisableBlockCommand      = new RelayCommand(OnDisableBlockCommand, HasSelectedEnabledBlock);
            EnableBlockCommand       = new RelayCommand(OnEnableBlockCommand, HasSelectedDisabledBlock);
            CopyBlockCommand         = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
            CopyBlockStyleCommand    = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null);
            PasteBlockCommand        = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
            PasteBlockStyleCommand   = new RelayCommand(OnPasteBlockStyleCommand, () => SelectedBlockViewModel != null);
            ExpandAllBlocksCommand   = new RelayCommand(OnExpandAllBlocksCommand);
            CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand);

            var icon = new BitmapImage();

            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/script_icon.png");
            icon.EndInit();
            IconSource = icon;
        }
        public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory,
                                         IItemFilterBlockTranslator blockTranslator,
                                         IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
                                         IItemFilterPersistenceService persistenceService,
                                         IMessageBoxService messageBoxService)
        {
            _itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
            _blockTranslator = blockTranslator;
            _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
            _avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
            _persistenceService        = persistenceService;
            _messageBoxService         = messageBoxService;
            _itemFilterBlockViewModels = new ObservableCollection <IItemFilterBlockViewModel>();

            ToggleShowAdvancedCommand = new RelayCommand <bool>(OnToggleShowAdvancedCommand);
            ClearFilterCommand        = new RelayCommand(OnClearFilterCommand, () => BlockFilterPredicate != null);
            CloseCommand             = new RelayCommand(OnCloseCommand);
            DeleteBlockCommand       = new RelayCommand(OnDeleteBlockCommand, () => SelectedBlockViewModel != null);
            MoveBlockToTopCommand    = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
            MoveBlockUpCommand       = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
            MoveBlockDownCommand     = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null);
            MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
            AddBlockCommand          = new RelayCommand(OnAddBlockCommand);
            AddSectionCommand        = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
            DisableBlockCommand      = new RelayCommand(OnDisableBlockCommand, HasSelectedEnabledBlock);
            EnableBlockCommand       = new RelayCommand(OnEnableBlockCommand, HasSelectedDisabledBlock);
            CopyBlockCommand         = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
            CopyBlockStyleCommand    = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null);
            PasteBlockCommand        = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
            PasteBlockStyleCommand   = new RelayCommand(OnPasteBlockStyleCommand, () => SelectedBlockViewModel != null);
            ExpandAllBlocksCommand   = new RelayCommand(OnExpandAllBlocksCommand);
            CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand);

            var icon = new BitmapImage();

            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/script_icon.png");
            icon.EndInit();
            IconSource = icon;
        }
        public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory,
                                         IItemFilterBlockTranslator blockTranslator,
                                         IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
                                         IItemFilterPersistenceService persistenceService,
                                         IMessageBoxService messageBoxService,
                                         IClipboardService clipboardService,
                                         IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
        {
            _itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
            _blockTranslator = blockTranslator;
            _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
            _avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
            _persistenceService = persistenceService;
            _messageBoxService = messageBoxService;
            _clipboardService = clipboardService;
            _blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
            _itemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModel>();
            
            ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
            ClearFilterCommand = new RelayCommand(OnClearFilterCommand, () => BlockFilterPredicate != null);
            CloseCommand = new RelayCommand(async () => await OnCloseCommand());
            DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => SelectedBlockViewModel != null);
            MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
            MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
            MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null);
            MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
            AddBlockCommand = new RelayCommand(OnAddBlockCommand);
            AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
            DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, HasSelectedEnabledBlock);
            EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, HasSelectedDisabledBlock);
            CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
            CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null);
            PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
            PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => SelectedBlockViewModel != null);
            ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand);
            CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand);

            var icon = new BitmapImage();
            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/script_icon.png");
            icon.EndInit();
            IconSource = icon;
        }
Example #8
0
 public ItemFilterScriptTranslator(IItemFilterBlockTranslator blockTranslator,
                                   IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
 {
     _blockTranslator            = blockTranslator;
     _blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
 }
 public ItemFilterScriptTranslator(IItemFilterBlockTranslator blockTranslator,
                                   IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
 {
     _blockTranslator = blockTranslator;
     _blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
 }