private void spliteBlock_RunWork(object sender, DoWorkEventArgs e) { var bw = sender as BackgroundWorker; BlockMaker bm = new BlockMaker(txtCityName.Text, decimal.Parse(txtCoordinateOffset.Text)); bm.NewRound += Bm_NewRound; var blocks = bm.SplitBlock(); e.Result = blocks; }
private void spliteBlock_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { sw.Stop(); _blocks = e.Result as List <Block>; var distance = 0d; if (_blocks.Count > 1) { distance = BlockMaker.GetTwoBlockDistance(_blocks[0].Center, _blocks[1].Center); } var msg = string.Format("分块完成,分块间距{4}米(2000米以内最佳),总数量:{0},耗时:{1}小时{2}分钟{3}秒\r\n", _blocks.Count, sw.Elapsed.Hours, sw.Elapsed.Minutes, sw.Elapsed.Seconds, distance); MessageBox.Show(msg); txtMessage.Text += msg; txtMessage.SelectionStart = txtMessage.Text.Length; txtMessage.ScrollToCaret(); ChangeAllCtrlStatus(true); }
private void DeserializeBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result != null) { picMap.Image = e.Result as Bitmap; var distance = 0d; if (_blocks.Count > 1) { distance = BlockMaker.GetTwoBlockDistance(_blocks[0].Center, _blocks[1].Center); } var msg = string.Format("反序列化成功,分块间距{1}米(2000米以内最佳),总数量:{0}\r\n", _blocks.Count, distance); MessageBox.Show(msg); txtMessage.Text += msg; txtMessage.SelectionStart = txtMessage.Text.Length; txtMessage.ScrollToCaret(); } else { MessageBox.Show("反序列化失败"); } ChangeAllCtrlStatus(true); }