|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestAssembly
{
using System;
using System.ComponentModel;
using System.Diagnostics;
using AsyncGen;
public partial class ClientWithMultipleOutputs : ClientBase<TestAssembly.IServerWithMultipleOutputs>
{
private ComputeTracker _computeTracker;
public ClientWithMultipleOutputs(TestAssembly.IServerWithMultipleOutputs server)
:
base(server)
{
this._computeTracker = new ComputeTracker(this.server, this);
this._computeTracker.OperationCompleted += new AsyncGen.AsyncCompletedEventHandler<ComputeOutput>(this._computeTracker_OperationCompleted);
this._computeTracker.ApproximateResultsAvailable += new AsyncGen.ProgressChangedEventHandler<IntermediateResults>(this._computeTracker_ApproximateResultsAvailable);
}
public event AsyncGen.AsyncCompletedEventHandler<ComputeOutput> ComputeCompleted;
public event AsyncGen.ProgressChangedEventHandler<IntermediateResults> ApproximateResultsAvailable;
public double Compute(ref double x, out double y)
{
double value;
this._computeTracker.CreateOperation();
try
{
value = this.server.Compute(ref x, out y);
}
finally
{
this._computeTracker.CompleteOperation();
}
return value;
}
public void ComputeAsync(double x)
{
this._computeTracker.CreateOperation();
double y;
ComputeDelegate d = new ComputeDelegate(this.server.Compute);
d.BeginInvoke(ref x, out y, new System.AsyncCallback(this._computeTracker.PostOperationCompleted), null);
}
private void _computeTracker_ApproximateResultsAvailable(object sender, AsyncGen.ProgressChangedEventArgs<IntermediateResults> args)
{
if ((this.ApproximateResultsAvailable != null))
{
this.ApproximateResultsAvailable(this, args);
}
}
private void _computeTracker_OperationCompleted(object sender, AsyncGen.AsyncCompletedEventArgs<ComputeOutput> args)
{
if ((this.ComputeCompleted != null))
{
this.ComputeCompleted(this, args);
}
}
public struct ComputeOutput
{
public double _ReturnValue;
public double x;
public double y;
}
public struct IntermediateResults
{
public double @return;
public double x;
public double y;
}
private class ComputeTracker : OperationTracker<IServerWithMultipleOutputs, ClientWithMultipleOutputs, ComputeDelegate, ComputeOutput>, TestAssembly.IServerWithMultipleOutputsCallbacks
{
public ComputeTracker(IServerWithMultipleOutputs server, ClientWithMultipleOutputs client)
:
base(server, client)
{
}
public event AsyncGen.ProgressChangedEventHandler<IntermediateResults> ApproximateResultsAvailable;
protected override void CallEndInvoke(ComputeDelegate d, System.IAsyncResult iar, out ComputeOutput output)
{
output.x = default(double);
output._ReturnValue = d.EndInvoke(ref output.x, out output.y, iar);
}
protected virtual void OnApproximateResultsAvailable(object args)
{
if ((this.ApproximateResultsAvailable != null))
{
this.ApproximateResultsAvailable(this.client, ((AsyncGen.ProgressChangedEventArgs<IntermediateResults>)(args)));
}
}
void IServerWithMultipleOutputsCallbacks.ReportApproximateResults(int progress, double @return, double x, double y)
{
IntermediateResults results = new IntermediateResults();
results.@return = @return;
results.x = x;
results.y = y;
this.PostProgress<IntermediateResults>(new System.Threading.SendOrPostCallback(this.OnApproximateResultsAvailable), progress, results);
}
}
delegate double ComputeDelegate(ref double x, out double y);
}
}
|
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.
I got my B.Sc. in Mathematics and Computer Science from Tel Aviv University in 1997. Since then I have developed software in UNIX, Win32 and .NET. I currently live in Haifa.