/// <summary> /// Comprueba si se puede ejecutar una acción /// </summary> protected override bool CanExecuteAction(string action) { TreeConnectionsViewModel.NodeType nodeType = GetSelectedNodeTypeConverted(); switch (action) { case nameof(NewConnectionCommand): case nameof(NewDeploymentCommand): return(true); case nameof(OpenCommand): return(nodeType == NodeType.Connection || nodeType == NodeType.Deployment || nodeType == NodeType.Table); case nameof(ExecuteDeploymentCommand): return(nodeType == NodeType.Deployment); case nameof(DeleteCommand): return(nodeType == NodeType.Connection || nodeType == NodeType.Deployment); default: return(false); } }
public NodeRootViewModel(TreeSolutionBaseViewModel trvTree, IHierarchicalViewModel parent, TreeConnectionsViewModel.NodeType type, string text, bool lazyLoad = true) : base(trvTree, parent, text, type.ToString(), TreeConnectionsViewModel.IconType.Connection.ToString(), type, lazyLoad, true, MvvmColor.Red) { switch (type) { case TreeConnectionsViewModel.NodeType.ConnectionRoot: Icon = TreeConnectionsViewModel.IconType.Connection.ToString(); break; case TreeConnectionsViewModel.NodeType.SchemaRoot: Icon = TreeConnectionsViewModel.IconType.Schema.ToString(); break; case TreeConnectionsViewModel.NodeType.DeploymentRoot: Icon = TreeConnectionsViewModel.IconType.Deployment.ToString(); break; } PropertyChanged += (sender, args) => { if (args.PropertyName.Equals(nameof(IsChecked), StringComparison.CurrentCultureIgnoreCase)) { CheckChildNodes(); } }; }