|
using System;
using System.Windows.Forms;
namespace ApmHelperWinformsExample
{
/// <summary>
/// example if you have more parms than Func<> allows
/// </summary>
public partial class ApmHelperExample2 : Form
{
private readonly ApmHelper<Parms, double> _helper;
public ApmHelperExample2()
{
InitializeComponent();
this._helper = new ApmHelper<Parms, double>(Go);
}
private void button1_Click(object sender, EventArgs e)
{
var parms = new Parms {a = 1, b = 2, c = 3, d = 4};
this._helper.InvokeAsync(parms, this.Callback);
}
private void Callback(double d)
{
}
private static double Go(Parms parms)
{
return SomeWebServiceMaybe.SomeLongRunningAddFunction(parms.a, parms.b, parms.c, parms.d);
}
private class Parms
{
public int a, b, c, d;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.