using System; using System.Collections.Generic; using System.Text; namespace Nuclex.Support.Tracking { /// Base class for observable operations running in the background public abstract class Operation : Progression { /// Possible outcomes of an operation public enum Outcomes { /// The operation has not ended yet Pending, /// The operation has succeeded Success, /// The operation has failed Failure, } /* /// Begins executing the operation public abstract void BeginExecute(); public virtual void Execute() { try { BeginExecute(); this.outcome = EndExecute(); } catch(Exception exception) { this.outcome = Outcomes.Failure; } } /// Ends the public virtual Outcomes EndExecute() { WaitHandle.WaitOne(); return this.outcome; } /// The Outcome of the operation when it has finished public Outcomes Outcome { get { return this.outcome; } } /// Outcome of the operation protected Outcomes outcome; */ } } // namespace Nuclex.Support.Tracking