Changeset 10150 for trunk/sources
- Timestamp:
- 11/22/13 14:23:56 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
r8718 r10150 98 98 <Compile Include="ExtensionMethods\TreeNodeExtensions.cs" /> 99 99 <Compile Include="ListViewItemDateComparer.cs" /> 100 <Compile Include="MenuItems\CreateHiveJobMenuItem.cs" /> 101 <Compile Include="MenuItems\RunInHiveMenuItem.cs" /> 100 102 <Compile Include="Plugin.cs" /> 101 103 <Compile Include="Views\HiveJobManagerView.cs"> -
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 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r10130 r10150 351 351 /// </summary> 352 352 /// <param name="parentHiveTask">shall be null if its the root task</param> 353 private void UploadTaskWithChildren( Progress progress, HiveTask hiveTask, HiveTask parentHiveTask, IEnumerable<Guid> groups, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, bool isPrivileged, CancellationToken cancellationToken) {353 private void UploadTaskWithChildren(IProgress progress, HiveTask hiveTask, HiveTask parentHiveTask, IEnumerable<Guid> groups, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, bool isPrivileged, CancellationToken cancellationToken) { 354 354 taskUploadSemaphore.WaitOne(); 355 355 bool semaphoreReleased = false; -
trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs
r9893 r10150 157 157 } 158 158 159 private Progress progress;160 public Progress Progress {159 private IProgress progress; 160 public IProgress Progress { 161 161 get { return progress; } 162 162 set { -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs
r10130 r10150 60 60 } 61 61 62 public EngineTask(IEngine engine) { 63 this.Item = engine; 64 } 62 public EngineTask(IEngine engine) : base(engine) { } 65 63 66 64 [StorableConstructor] -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Tasks/ItemTask.cs
r10130 r10150 22 22 using System; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Hive; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.PluginInfrastructure; 28 30 29 31 namespace HeuristicLab.Clients.Hive { … … 76 78 this.Item = cloner.Clone(original.Item); 77 79 } 80 public ItemTask(IItem item) { 81 Item = item; 82 } 78 83 79 84 [StorableHook(HookType.AfterDeserialization)] … … 216 221 return Name; 217 222 } 223 224 #region Helpers 225 public static bool IsTypeSupported(Type itemType) { 226 var supportedHiveTaskTypes = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 227 .Select(t => t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)).PropertyType); 228 return supportedHiveTaskTypes.Any(x => x.IsAssignableFrom(itemType)); 229 } 230 231 public static Type GetHiveTaskType(Type itemType) { 232 if (!IsTypeSupported(itemType)) throw new Exception("Item " + itemType + " is not supported for Hive."); 233 234 var typeHiveTaskMap = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 235 .Select(t => new Tuple<Type, Type>(t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)).PropertyType, t)); 236 237 return typeHiveTaskMap.Single(x => x.Item1.IsAssignableFrom(itemType)).Item2; 238 } 239 240 public static ItemTask GetItemTaskForItem(IItem item) { 241 Type itemType = item.GetType(); 242 Type hiveTaskType = GetHiveTaskType(itemType); 243 return Activator.CreateInstance(hiveTaskType, new object[] { item }) as ItemTask; 244 } 245 #endregion 218 246 } 219 247 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs
r10130 r10150 50 50 } 51 51 52 public OptimizerTask(IOptimizer optimizer) {53 this.Item = optimizer;52 public OptimizerTask(IOptimizer optimizer) 53 : base(optimizer) { 54 54 55 55 if (optimizer is Experiment) {
Note: See TracChangeset
for help on using the changeset viewer.