- Timestamp:
- 11/22/13 14:23:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r10130 r10150 23 23 using System.ComponentModel; 24 24 using System.Linq; 25 using System.Reflection;26 25 using System.Text; 27 26 using System.Threading; … … 472 471 Type objType = obj.GetType(); 473 472 474 var typeHiveTaskMap = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 475 .Select(t => new Tuple<PropertyInfo, Type>(t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)), t)); 476 477 var hiveTaskFound = typeHiveTaskMap.Any(x => x.Item1.PropertyType.IsAssignableFrom(objType)); 478 473 var hiveTaskFound = ItemTask.IsTypeSupported(objType); 479 474 if (hiveTaskFound) { 480 475 if (Content.Id != Guid.Empty) e.Effect = DragDropEffects.None; … … 486 481 private void jobsTreeView_DragDrop(object sender, DragEventArgs e) { 487 482 if (e.Effect != DragDropEffects.None) { 488 var obj = e.Data.GetData(Constants.DragDropDataFormat) as IDeepCloneable; 489 Type objType = obj.GetType(); 490 491 var typeHiveTaskMap = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 492 .Select(t => new Tuple<PropertyInfo, Type>(t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)), t)); 493 494 var hiveTaskType = typeHiveTaskMap.Single(x => x.Item1.PropertyType.IsAssignableFrom(objType)).Item2; 495 496 IDeepCloneable newObj = null; 483 var obj = e.Data.GetData(Constants.DragDropDataFormat) as IItem; 484 485 IItem newObj = null; 497 486 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 498 newObj = obj.Clone(new Cloner()) ;487 newObj = obj.Clone(new Cloner()) as IItem; 499 488 } else { 500 489 newObj = obj; … … 512 501 } 513 502 514 ItemTask hiveTask = Activator.CreateInstance(hiveTaskType, new object[] { newObj }) as ItemTask;503 ItemTask hiveTask = ItemTask.GetItemTaskForItem(newObj); 515 504 Content.HiveTasks.Add(hiveTask.CreateHiveTask()); 516 505 }
Note: See TracChangeset
for help on using the changeset viewer.