Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/08 23:24:36 (16 years ago)
Author:
kgrading
Message:

implemented the persistance management (#390)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs

    r782 r816  
    2525using System.Text;
    2626using System.Diagnostics;
     27using System.Xml;
    2728
    2829namespace HeuristicLab.Hive.Client.Common {
    2930  [Serializable]
    3031  public class TestJob: JobBase {
     32
     33    private int runValue = 0;
     34
    3135    public override void Run() {
    32       for (int x = 0; x < 10; x++) {
     36      int max = 10;
     37      while(runValue < max && abort == false) {
    3338        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");
    4149      }     
    4250      OnJobStopped();
    4351    }
     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
    4470  }
    4571}
Note: See TracChangeset for help on using the changeset viewer.