Changeset 15767 for branches/2839_HiveProjectManagement
- Timestamp:
- 02/13/18 15:32:00 (7 years ago)
- Location:
- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.Designer.cs
r15422 r15767 128 128 this.projectsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.projectsTreeView_AfterSelect); 129 129 this.projectsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragDrop); 130 this.projectsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragEnter );131 this.projectsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_Drag Over);130 this.projectsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragEnterOver); 131 this.projectsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragEnterOver); 132 132 this.projectsTreeView.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.projectsTreeView_QueryContinueDrag); 133 133 // -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r15760 r15767 293 293 294 294 private void projectsTreeView_DragDrop(object sender, DragEventArgs e) { 295 if (e.Effect == DragDropEffects.None) return; 296 295 297 var sourceNode = (TreeNode)e.Data.GetData(typeof(TreeNode)); 296 298 if (sourceNode == null) return; 297 var source Resource= ((Project)sourceNode.Tag);298 if (source Resource== null) return;299 var sourceProject = ((Project)sourceNode.Tag); 300 if (sourceProject == null) return; 299 301 300 302 var treeView = (TreeView)sender; … … 313 315 MessageBoxButtons.OK, 314 316 MessageBoxIcon.Information); 315 return; 317 return; 318 } 319 if(!HiveAdminClient.Instance.CheckParentChange(sourceProject, targetProject)) { 320 MessageBox.Show( 321 "You cannot drag to this project.", 322 "HeuristicLab Hive Administrator", 323 MessageBoxButtons.OK, 324 MessageBoxIcon.Information); 325 return; 316 326 } 317 327 … … 320 330 } else { 321 331 sourceNode.Parent.Nodes.Remove(sourceNode); 322 source Resource.ParentProjectId = null;332 sourceProject.ParentProjectId = null; 323 333 } 324 334 … … 327 337 } else if(targetProject.Id != Guid.Empty) { 328 338 targetNode.Nodes.Add(sourceNode); 329 source Resource.ParentProjectId = targetProject.Id;330 } 331 332 selectedProject = source Resource;339 sourceProject.ParentProjectId = targetProject.Id; 340 } 341 342 selectedProject = sourceProject; 333 343 OnContentChanged(); 334 344 } … … 340 350 } 341 351 342 private void projectsTreeView_DragEnter (object sender, DragEventArgs e) {352 private void projectsTreeView_DragEnterOver(object sender, DragEventArgs e) { 343 353 e.Effect = DragDropEffects.Move; 344 } 345 346 private void projectsTreeView_DragOver(object sender, DragEventArgs e) { 347 e.Effect = DragDropEffects.Move; 354 355 var sourceNode = (TreeNode)e.Data.GetData(typeof(TreeNode)); 356 var sourceProject = ((Project)sourceNode.Tag); 357 358 var targetPoint = projectsTreeView.PointToClient(new Point(e.X, e.Y)); 359 var targetNode = projectsTreeView.GetNodeAt(targetPoint); 360 var targetProject = (targetNode != null) ? (Project)targetNode.Tag : null; 361 362 if ((!IsAdmin() && (targetNode == null || targetProject == null)) 363 || sourceNode == null 364 || sourceProject == null 365 || sourceNode == targetNode 366 || (targetProject != null && targetProject.Id == Guid.Empty) 367 || (targetProject != null && targetProject.Id == sourceProject.ParentProjectId) 368 || !HiveAdminClient.Instance.CheckParentChange(sourceProject, targetProject)) { 369 e.Effect = DragDropEffects.None; 370 } 348 371 } 349 372 -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r15742 r15767 160 160 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterSelect); 161 161 this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragDrop); 162 this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnter );163 this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_Drag Over);162 this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnterOver); 163 this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnterOver); 164 164 this.treeView.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.treeSlaveGroup_QueryContinueDrag); 165 165 // -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r15760 r15767 308 308 309 309 private void treeSlaveGroup_DragDrop(object sender, DragEventArgs e) { 310 if (e.Effect == DragDropEffects.None) return; 311 310 312 var sourceNode = (TreeNode)e.Data.GetData(typeof(TreeNode)); 311 313 if (sourceNode == null) return; … … 336 338 MessageBoxIcon.Information); 337 339 return; 338 } else if (targetResource != null && targetResource.Id == Guid.Empty) {340 } else if (targetResource != null && targetResource.Id == Guid.Empty) { 339 341 MessageBox.Show( 340 342 "You cannot drag resources to a not yet stored resource group.", … … 342 344 MessageBoxButtons.OK, 343 345 MessageBoxIcon.Information); 344 return; 346 return; 347 } else if(!HiveAdminClient.Instance.CheckParentChange(sourceResource, targetResource)) { 348 MessageBox.Show( 349 "You cannot drag resources to this group.", 350 "HeuristicLab Hive Administrator", 351 MessageBoxButtons.OK, 352 MessageBoxIcon.Information); 353 return; 345 354 } else if (targetNode != null && (targetNode.Text == ungroupedGroupName || targetNode.Parent != null && targetNode.Parent.Text == ungroupedGroupName)) { 346 355 MessageBox.Show( … … 376 385 } 377 386 378 private void treeSlaveGroup_DragEnter (object sender, DragEventArgs e) {387 private void treeSlaveGroup_DragEnterOver(object sender, DragEventArgs e) { 379 388 e.Effect = DragDropEffects.Move; 380 } 381 382 private void treeSlaveGroup_DragOver(object sender, DragEventArgs e) { 383 e.Effect = DragDropEffects.Move; 389 390 var sourceNode = (TreeNode)e.Data.GetData(typeof(TreeNode)); 391 var sourceResource = ((Resource)sourceNode.Tag); 392 393 var targetPoint = treeView.PointToClient(new Point(e.X, e.Y)); 394 var targetNode = treeView.GetNodeAt(targetPoint); 395 var targetResource = (targetNode != null) ? (Resource)targetNode.Tag : null; 396 397 if(!IsAdmin() 398 || sourceNode == null 399 || sourceResource == null 400 || sourceNode == targetNode 401 || (targetResource != null && targetResource is Slave) 402 || (targetResource != null && targetResource.Id == Guid.Empty) 403 || (targetResource != null && targetResource.Id == sourceResource.ParentResourceId) 404 || !HiveAdminClient.Instance.CheckParentChange(sourceResource, targetResource) 405 || (targetNode != null && (targetNode.Text == ungroupedGroupName || targetNode.Parent != null && targetNode.Parent.Text == ungroupedGroupName))) { 406 e.Effect = DragDropEffects.None; 407 } 384 408 } 385 409
Note: See TracChangeset
for help on using the changeset viewer.