public ScriptViewModel(INodeRegistry registry = null, INodeViewModelFactory viewModelFactory = null, Script script = null) { _registry = registry ?? EmptyNodeRegistry.Instance; _viewModelFactory = viewModelFactory ?? new NodeViewModelFactory(_registry); GroupSelectedCommand = new ScriptingCommand(() => GroupSelected()) { CanExecute = false }; UngroupSelectedCommand = new ScriptingCommand(UngroupSelected) { CanExecute = false }; CopySelectedCommand = new ScriptingCommand(CopySelected) { CanExecute = false }; CutSelectedCommand = new ScriptingCommand(CutSelected) { CanExecute = false }; DuplicateSelectedCommand = new ScriptingCommand(DuplicateSelected) { CanExecute = false }; PasteCommand = new ScriptingCommand(() => Paste()) { CanExecute = true }; UndoCommand = new ScriptingCommand(Undo) { CanExecute = false }; RedoCommand = new ScriptingCommand(Redo) { CanExecute = false }; //BindingOperations.SetBinding(UndoCommand, ScriptingCommand.CanExecuteProperty, new Binding //{ // Path = new PropertyPath(nameof(UndoStackViewModel.CanUndo)), // Source = UndoStack //}); //BindingOperations.SetBinding(RedoCommand, ScriptingCommand.CanExecuteProperty, new Binding //{ // Path = new PropertyPath(nameof(UndoStackViewModel.CanRedo)), // Source = UndoStack //}); SelectAllCommand = new ScriptingCommand(SelectAll); DeleteSelectedCommand = new ScriptingCommand(DeleteSelected); ResetZoomCommand = new ScriptingCommand(ResetZoom); if (script != null) { SetScript(script); } }
internal NodeViewModel( INode node, INodeViewModelFactory nodeViewModelFactory, IEventAggregator eventAggregator, IProjectService<Project> projectService ) : base( nodeViewModelFactory, eventAggregator, projectService ) { Node = node; node.PropertyChanged += OnNodePropertyChanged; MouseDownCommand = new DelegateCommand<MouseButtonEventArgs>( OnMouseDown ); EditNodeCommand = new DelegateCommand( OnEditNode ); DeleteCommand = new DelegateCommand( DeleteChild ); PushBackToOriginCommand = new DelegateCommand( PushBackToOrigin, () => Origin != null ); eventAggregator.GetEvent<NodeActivatedEvent>().Subscribe( OnActivated ); eventAggregator.GetEvent<NodeSelectedEvent>().Subscribe( OnSelected ); }
protected NodeViewModelBase( INodeViewModelFactory nodeViewModelFactory, IEventAggregator eventAggregator, IProjectService<Project> projectService ) { Contract.RequiresNotNull( nodeViewModelFactory, "nodeViewModelFactory" ); Contract.RequiresNotNull( eventAggregator, "eventAggregator" ); Contract.RequiresNotNull( projectService, "projectRepository" ); myNodeViewModelFactory = nodeViewModelFactory; EventAggregator = eventAggregator; ProjectService = projectService; NewCommand = new DelegateCommand( AddNewChild ); ExpandAllCommand = new DelegateCommand( ExpandAll ); CollapseAllCommand = new DelegateCommand( CollapseAll ); ShowContentHint = false; }
public ScriptDialog(Script script, INodeRegistry registry = null, INodeViewModelFactory viewModelFactory = null) { InitializeComponent(); this.DataContext = new ScriptViewModel(registry, viewModelFactory, script); }
public TreeViewModel( INodeViewModelFactory nodeViewModelFactory, IEventAggregator eventAggregator, IProjectService<Project> projectSerivce ) : base( nodeViewModelFactory, eventAggregator, projectSerivce ) { ProjectService.ProjectChanged += OnSourceLoaded; }