diff --git a/Implab/Components/Disposable.cs b/Implab/Components/Disposable.cs --- a/Implab/Components/Disposable.cs +++ b/Implab/Components/Disposable.cs @@ -8,7 +8,7 @@ namespace Implab.Components { /// Base class the objects which support disposing. /// public class Disposable : IDisposable { - + int m_disposed; public event EventHandler Disposed; @@ -75,11 +75,9 @@ namespace Implab.Components { /// из нескольких потоков. /// protected virtual void Dispose(bool disposing) { - if (disposing) { - EventHandler temp = Disposed; - if (temp != null) - temp(this, EventArgs.Empty); - } + if (disposing) + Disposed.DispatchEvent(this, EventArgs.Empty); + } [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Dipose(bool) and GC.SuppessFinalize are called")] diff --git a/Implab/Safe.cs b/Implab/Safe.cs --- a/Implab/Safe.cs +++ b/Implab/Safe.cs @@ -6,6 +6,10 @@ using System.Text.RegularExpressions; using System.Diagnostics; using System.Collections; +#if NET_4_5 +using System.Threading.Tasks; +#endif + namespace Implab { public static class Safe @@ -117,6 +121,9 @@ namespace Implab } } + public static void NoWait(IPromise promise) { + } + [DebuggerStepThrough] public static IPromise Run(Func> action) { ArgumentNotNull(action, "action"); @@ -128,5 +135,10 @@ namespace Implab } } +#if NET_4_5 + public static void NoWait(Task t) { + } +#endif + } }