Changeset 4170 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/JobItem.cs
- Timestamp:
- 08/06/10 09:20:18 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/JobItem.cs
r4145 r4170 21 21 public override Image ItemImage { 22 22 get { 23 if ( jobDto.State == State.Offline) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared;24 else if ( jobDto.State == State.Idle) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared;25 else if ( jobDto.State == State.Calculating) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStarted;26 else if ( jobDto.State == State.Abort) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped;27 else if ( jobDto.State == State.Failed) return HeuristicLab.Common.Resources.VS2008ImageLibrary.Error;28 else if ( jobDto.State == State.Finished) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped;23 if (State == State.Offline) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared; 24 else if (State == State.Idle) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared; 25 else if (State == State.Calculating) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStarted; 26 else if (State == State.Abort) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped; 27 else if (State == State.Failed) return HeuristicLab.Common.Resources.VS2008ImageLibrary.Error; 28 else if (State == State.Finished) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped; 29 29 else return HeuristicLab.Common.Resources.VS2008ImageLibrary.Event; 30 30 } … … 33 33 [Storable] 34 34 private JobDto jobDto; 35 /// <summary> 36 /// Some static information about the job. Don't use State-Information out of there 37 /// </summary> 35 38 public JobDto JobDto { 36 39 get { return jobDto; } … … 46 49 47 50 [Storable] 51 private JobResult jobResult; 52 public JobResult JobResult { 53 private get { return jobResult; } 54 set { 55 if (jobResult != value) { 56 jobResult = value; 57 OnJobStateChanged(); 58 OnToStringChanged(); 59 OnItemImageChanged(); 60 } 61 } 62 } 63 64 public State State { 65 get { return jobResult != null ? JobResult.State : JobDto.State; } 66 } 67 68 public double? Percentage { 69 get { return jobResult != null ? JobResult.Percentage : JobDto.Percentage; } 70 } 71 72 public string Exception { 73 get { return jobResult != null ? JobResult.Exception : JobDto.Exception; } 74 } 75 76 public DateTime? DateCalculated { 77 get { return jobResult != null ? JobResult.DateCalculated : JobDto.DateCalculated; } 78 } 79 80 public DateTime? DateFinished { 81 get { return jobResult != null ? JobResult.DateFinished : JobDto.DateFinished; } 82 } 83 84 [Storable] 48 85 private ResponseObject<SerializedJob> latestSnapshot; 49 86 public ResponseObject<SerializedJob> LatestSnapshot { … … 52 89 if (latestSnapshot != value) { 53 90 latestSnapshot = value; 54 latestSnapshotTime = DateTime.Now; 91 if (value != null) { 92 latestSnapshotTime = DateTime.Now; 93 } 55 94 SnapshotRequestedState = Experiment.SnapshotRequestedState.Idle; 56 95 OnLatestSnapshotChanged(); … … 114 153 } 115 154 155 public event EventHandler JobStateChanged; 156 private void OnJobStateChanged() { 157 LogMessage("JobStateChanged"); 158 EventHandler handler = JobStateChanged; 159 if (handler != null) handler(this, EventArgs.Empty); 160 } 161 116 162 public void LogMessage(string message) { 117 163 lock (locker) { … … 128 174 clone.log = (ILog)cloner.Clone(this.log); 129 175 clone.optimizer = (IOptimizer)cloner.Clone(this.optimizer); 176 clone.jobResult = (JobResult)cloner.Clone(this.jobResult); 130 177 return clone; 131 178 } … … 142 189 } 143 190 191 144 192 } 145 193 }
Note: See TracChangeset
for help on using the changeset viewer.