private void NodeAnalysisTable_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Get NodeModel(s) that correspond to selected row(s) var selectedNodes = new List <NodeModel>(); foreach (var item in e.AddedItems) { // Check NodeModel valid before actual selection var nodeModel = (item as PropertyPaletteNodeViewModel).NodeModel; if (nodeModel != null) { selectedNodes.Add(nodeModel); } } if (selectedNodes.Count() > 0) { // Select var command = new DynamoModel.SelectModelCommand(selectedNodes.Select(nm => nm.GUID), ModifierKeys.None); commandExecutive.ExecuteCommand(command, uniqueId, "NodePropertyPalette"); // Focus on selected viewModelCommandExecutive.FindByIdCommand(selectedNodes.First().GUID.ToString()); } }
internal void ClearSelection() { // Group is created already.So just populate it. var selectNothing = new DynamoModel.SelectModelCommand(Guid.Empty, System.Windows.Input.ModifierKeys.None.AsDynamoType()); WorkspaceViewModel.DynamoViewModel.ExecuteCommand(selectNothing); }
public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationModel model) { annotationModel = model; this.WorkspaceViewModel = workspaceViewModel; model.PropertyChanged += model_PropertyChanged; // Group is created already.So just populate it. var selectNothing = new DynamoModel.SelectModelCommand(Guid.Empty, System.Windows.Input.ModifierKeys.None.AsDynamoType()); WorkspaceViewModel.DynamoViewModel.ExecuteCommand(selectNothing); }
public override int Mutate(NodeModel node) { DynamoViewModel.UIDispatcher.Invoke(new Action(() => { DynamoModel.SelectModelCommand selectNodeCommand = new DynamoModel.SelectModelCommand(node.GUID, ModifierKeys.None.AsDynamoType()); DynamoViewModel.ExecuteCommand(selectNodeCommand); DynamoModel.Copy(); DynamoModel.Paste(); })); return(1); }
public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationModel model) { annotationModel = model; this.WorkspaceViewModel = workspaceViewModel; model.PropertyChanged += model_PropertyChanged; //https://jira.autodesk.com/browse/QNTM-3770 //Notes and Groups are serialized as annotations. Do not unselect the node selection during //Notes serialization if (model.Nodes.Count() > 0) { // Group is created already.So just populate it. var selectNothing = new DynamoModel.SelectModelCommand(Guid.Empty, System.Windows.Input.ModifierKeys.None.AsDynamoType()); WorkspaceViewModel.DynamoViewModel.ExecuteCommand(selectNothing); } }
public void SelectModelImplShouldNotCrashTest() { //Assert Assert.DoesNotThrow( () => { //Insert a node GUID that does not exist in workspace var ids = new System.Collections.Generic.List <Guid>() { Guid.NewGuid() }; var selectCommand = new DynamoModel.SelectModelCommand(ids, ModifierKeys.Shift); //Act CurrentDynamoModel.ExecuteCommand(selectCommand); }); }
public void SelectModelImplTest() { //Arrange string openPath = Path.Combine(TestDirectory, @"core\DetailedPreviewMargin_Test.dyn"); RunModel(openPath); //This will add a new DSFunction node to the current workspace var addNode = new DSFunction(CurrentDynamoModel.LibraryServices.GetFunctionDescriptor("+")); CurrentDynamoModel.CurrentWorkspace.AddAndRegisterNode(addNode, false); //Select the node created (DSFunction) DynamoSelection.Instance.Selection.Add(addNode); var ids = DynamoSelection.Instance.Selection.OfType <NodeModel>().Select(x => x.GUID).ToList(); var selectCommand = new DynamoModel.SelectModelCommand(ids, ModifierKeys.Shift); //Act CurrentDynamoModel.ExecuteCommand(selectCommand); //Assert Assert.Greater(ids.Count, 0); //At least one guid was found Assert.IsNotNull(selectCommand); }