B
btb900
Guest
I am doing this :
async Task MoveWaferAsync(double X, double Y )
{
try
{
List<Task> ThreadList = new List<Task>();
ThreadList.Add( moveXTask(X));
ThreadList.Add( moveYTask(Y));
Task.WaitAll(ThreadList.ToArray());
}
catch (Exception err)
{
AppendDisplayBox(err.Message);
}
}
but it is doing them one at a time ...
why ?
async Task moveXTask (double X)
{
try
{
await Xstage.MoveAbsoluteAsync(X);
}
catch ( Exception err)
{
if (err.Message == "Motor timed out before action was completed")
{
double Xlocation = Math.Abs((Xstage.GetPosition() - X));
if (Xlocation > 1.1)
{
// MessageBox.Show(err.Message + "Motor might not be in the right location");
}
await Xstage.resetMotor();
}
else
{
// MessageBox.Show(err.Message);
}
}
}
async Task moveYTask(double Y)
{
try
{
await Ystage.MoveAbsoluteAsync(Y);
}
catch (Exception err)
{
if (err.Message == "Motor timed out before action was completed")
{
double Ylocation = Math.Abs((Ystage.GetPosition() - Y));
if (Ylocation > 1.1)
{
// MessageBox.Show(err.Message + "Motor might not be in the right location");
}
await Ystage.resetMotor();
}
else
{
// MessageBox.Show(err.Message);
}
}
}
I want them to happen at the same time, then move on ...
why is that not working ???
Continue reading...
async Task MoveWaferAsync(double X, double Y )
{
try
{
List<Task> ThreadList = new List<Task>();
ThreadList.Add( moveXTask(X));
ThreadList.Add( moveYTask(Y));
Task.WaitAll(ThreadList.ToArray());
}
catch (Exception err)
{
AppendDisplayBox(err.Message);
}
}
but it is doing them one at a time ...
why ?
async Task moveXTask (double X)
{
try
{
await Xstage.MoveAbsoluteAsync(X);
}
catch ( Exception err)
{
if (err.Message == "Motor timed out before action was completed")
{
double Xlocation = Math.Abs((Xstage.GetPosition() - X));
if (Xlocation > 1.1)
{
// MessageBox.Show(err.Message + "Motor might not be in the right location");
}
await Xstage.resetMotor();
}
else
{
// MessageBox.Show(err.Message);
}
}
}
async Task moveYTask(double Y)
{
try
{
await Ystage.MoveAbsoluteAsync(Y);
}
catch (Exception err)
{
if (err.Message == "Motor timed out before action was completed")
{
double Ylocation = Math.Abs((Ystage.GetPosition() - Y));
if (Ylocation > 1.1)
{
// MessageBox.Show(err.Message + "Motor might not be in the right location");
}
await Ystage.resetMotor();
}
else
{
// MessageBox.Show(err.Message);
}
}
}
I want them to happen at the same time, then move on ...
why is that not working ???
Continue reading...