Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3406 for trunk


Ignore:
Timestamp:
04/19/10 03:08:10 (14 years ago)
Author:
mkommend
Message:

added implementation of propagate changes and save asynchronous (ticket #980)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/Content/StorableContent.cs

    r3405 r3406  
    2424using System.Linq;
    2525using System.Text;
     26using System.Threading;
     27using System.Reflection;
    2628
    2729namespace HeuristicLab.Common {
     
    6668
    6769    protected void PropagateSaveEnabledChanges() {
    68       //TODO implement propagation of changes
     70      Type type = this.GetType();
     71      foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Default)) {
     72        if (typeof(IStorableContent).IsAssignableFrom(fieldInfo.GetType())) {
     73          IStorableContent storableContent = (IStorableContent)fieldInfo.GetValue(this);
     74          storableContent.SaveEnabled = this.saveEnabled;
     75        }
     76      }
    6977    }
    7078
     
    8391
    8492    protected virtual void SaveAsnychronous() {
    85       //TODO implement async call to save method
     93      ThreadPool.QueueUserWorkItem(
     94        new WaitCallback(delegate(object arg) {
     95        try { this.Save(); }
     96        catch (Exception ex) {
     97          this.OnSaveOperationFinished(ex);
     98        }
     99      })
     100      );
    86101    }
    87102    void IStorableContent.SaveAsynchronous() {
Note: See TracChangeset for help on using the changeset viewer.