Changeset 816 for trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs
- Timestamp:
- 11/25/08 23:24:36 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs
r782 r816 25 25 using System.Text; 26 26 using System.Diagnostics; 27 using System.Xml; 27 28 28 29 namespace HeuristicLab.Hive.Client.Common { 29 30 [Serializable] 30 31 public class TestJob: JobBase { 32 33 private int runValue = 0; 34 31 35 public override void Run() { 32 for (int x = 0; x < 10; x++) { 36 int max = 10; 37 while(runValue < max && abort == false) { 33 38 for (int y = 0; y < Int32.MaxValue; y++) ; 34 if (abort == true) { 35 Logging.GetInstance().Info(this.ToString(), "Job Processing aborted"); 36 Debug.WriteLine("Job Abort Processing"); 37 break; 38 } 39 Logging.GetInstance().Info(this.ToString(), "Iteration " + x + " done"); 40 Debug.WriteLine("Iteration " + x + " done"); 39 if (abort == true) { 40 Logging.GetInstance().Info(this.ToString(), "Job Processing aborted"); 41 Debug.WriteLine("Job Abort Processing"); 42 break; 43 } 44 runValue++; 45 Progress = runValue / max; 46 Logging.GetInstance().Info(this.ToString(), "Iteration " + runValue + " done"); 47 Debug.WriteLine("Iteration " + runValue + " done"); 48 Debug.WriteLine("Progress " + Progress*100 + " Percent"); 41 49 } 42 50 OnJobStopped(); 43 51 } 52 public override System.Xml.XmlNode GetXmlNode(string name, System.Xml.XmlDocument document, IDictionary<Guid, HeuristicLab.Core.IStorable> persistedObjects) { 53 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 54 55 XmlNode startValue = document.CreateNode(XmlNodeType.Element, "StartValue", null); 56 startValue.InnerText = Convert.ToString(runValue); 57 58 node.AppendChild(startValue); 59 return node; 60 } 61 62 public override void Populate(XmlNode node, IDictionary<Guid, HeuristicLab.Core.IStorable> restoredObjects) { 63 base.Populate(node, restoredObjects); 64 65 XmlNode startValue = node.SelectSingleNode("StartValue"); 66 runValue = Convert.ToInt32(startValue.InnerText); 67 } 68 69 44 70 } 45 71 }
Note: See TracChangeset
for help on using the changeset viewer.