我有一个长时间运行的查询,当我尝试使用CancellationToken中止查询时没有任何反应。
float a =0;
Point p = new Point(pnlDisplay.Width / 2 - (pnlDisplay.Width / 2) /3, 200);
Triangle t = new Triangle(p, pnlDisplay.Width / 3, 0);
drawEqTriangle(e, t);
Point p1 = new Point();
Point p2 = new Point();
Point p3 = new Point();
p1.X = Convert.ToInt32(A.X + t.size / 3);
p1.Y = Convert.ToInt32(A.Y);
p2.X = Convert.ToInt32(A.X + (t.size - t.size / 3));
p2.Y = Convert.ToInt32(A.Y);
//////////////////////////////
p3.X = Convert.ToInt32((A.X - t.size / 3) * Math.Sin(a));
p3.Y = Convert.ToInt32((A.Y - t.size / 3) * Math.Cos(a));
drawTriangle(e, p1, p2, p3);
p1.X = Convert.ToInt32((B.X - t.size / 3 * Math.Cos(t.angle + Math.PI / 3)));
p1.Y = Convert.ToInt32((B.Y + t.size / 3 * Math.Sin(t.angle+ Math.PI / 3)));
p2.X = Convert.ToInt32((B.X - (t.size - t.size / 3) * Math.Cos(t.angle + Math.PI / 3)));
p2.Y = Convert.ToInt32((B.Y + (t.size - t.size / 3) * Math.Sin(t.angle + Math.PI / 3)));
//////////////////////////////
p3.X = Convert.ToInt32((B.X - t.size / 3) * Math.Cos(a));
p3.Y = Convert.ToInt32((B.Y - t.size / 3) * Math.Tan(a));
drawTriangle(e, p1, p2, p3);
答案 0 :(得分:1)
您需要在令牌上设置超时值,或手动取消令牌。