private void btn_Calc_Click(object sender, EventArgs e) { isStop = true; var result = PathFind.GetMatrixPath(origin, null); PrintDD(result); }
private void button2_Click(object sender, EventArgs e) { if (!isStop) { return; } isStop = false; System.Threading.ThreadPool.UnsafeQueueUserWorkItem(o => { try { PathFind.GetMatrixPath(origin, result => { if (isStop) { System.Threading.Thread.CurrentThread.Abort(); } this.Invoke(() => { PrintDD(result); }); }); isStop = true; } catch (Exception) { } }, null); //var result = PathFind.GetMatrixPath(origin, null); //if (result == null) //{ // ShowBox("当前地图无解"); // return; //} //else //{ // PrintDD(origin); // ShowBox("当前地图有解"); //} }