##// END OF EJS Templates
Added the chaining method to the non-generic IPromise
Added the chaining method to the non-generic IPromise

File last commit:

r76:c761fc982e1d v2
r96:daffa72a1cec v2
Show More
PromiseHelpers.cs
41 lines | 1.7 KiB | text/x-csharp | CSharpLexer
cin
Implab.Fx: implemented animation object...
r4 using System;
using System.Windows.Forms;
using System.Threading;
namespace Implab.Fx
{
public static class PromiseHelpers
{
/// <summary>
/// Перенаправляет обработку обещания в поток указанного элемента управления.
/// </summary>
/// <typeparam name="T">Тип результата обещания</typeparam>
/// <param name="that">Исходное обещание</param>
/// <param name="ctl">Элемент управления</param>
/// <returns>Новое обещание, обработчики которого будут выполнены в потоке элемента управления.</returns>
/// <exception cref="ArgumentNullException">Параметр не может быть <c>null</c>.</exception>
/// <example>
/// client
/// .Get("description.txt") // returns a promise
cin
Refactoring of the IPromise<T> interface...
r76 /// .DispatchToControl(m_ctl) // handle the promise in the thread of the control
cin
Implab.Fx: implemented animation object...
r4 /// .Then(
/// description => m_ctl.Text = description // now it's safe
/// )
/// </example>
cin
Refactoring of the IPromise<T> interface...
r76 public static IPromise<T> DispatchToControl<T>(this IPromise<T> that, Control ctl)
cin
Implab.Fx: implemented animation object...
r4 {
cin
Refactoring of the IPromise<T> interface...
r76 Safe.ArgumentNotNull(that, "that");
Safe.ArgumentNotNull(ctl, "ctl");
cin
Implab.Fx: implemented animation object...
r4
cin
promises refactoring
r72 var directed = new ControlBoundPromise<T>(ctl,that,true);
cin
Implab.Fx: implemented animation object...
r4
cin
Refactoring of the IPromise<T> interface...
r76 that.Last(
cin
promises refactoring
r72 directed.Resolve,
cin
Refactoring of the IPromise<T> interface...
r76 directed.Reject,
directed.Cancel
cin
Implab.Fx: implemented animation object...
r4 );
return directed;
}
}
}