Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/22/13 14:23:56 (11 years ago)
Author:
ascheibe
Message:

#2117

  • improved creation of ItemTasks from Items and moved common functionality to ItemTask
  • added a MenuItem for directly uploading tasks (e.g. from experiments, batchruns,...)
  • added a MenuItem for creating RefreshableHiveJobs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r10130 r10150  
    2323using System.ComponentModel;
    2424using System.Linq;
    25 using System.Reflection;
    2625using System.Text;
    2726using System.Threading;
     
    472471      Type objType = obj.GetType();
    473472
    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);
    479474      if (hiveTaskFound) {
    480475        if (Content.Id != Guid.Empty) e.Effect = DragDropEffects.None;
     
    486481    private void jobsTreeView_DragDrop(object sender, DragEventArgs e) {
    487482      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;
    497486        if (e.Effect.HasFlag(DragDropEffects.Copy)) {
    498           newObj = obj.Clone(new Cloner());
     487          newObj = obj.Clone(new Cloner()) as IItem;
    499488        } else {
    500489          newObj = obj;
     
    512501        }
    513502
    514         ItemTask hiveTask = Activator.CreateInstance(hiveTaskType, new object[] { newObj }) as ItemTask;
     503        ItemTask hiveTask = ItemTask.GetItemTaskForItem(newObj);
    515504        Content.HiveTasks.Add(hiveTask.CreateHiveTask());
    516505      }
Note: See TracChangeset for help on using the changeset viewer.