private void itmCarPlayTrack_Load(object sender, EventArgs e) { try { m_sQueryTimeDiff = int.Parse(Variable.sQueryPointTimeDiff); } catch { m_sQueryTimeDiff = 120; } Point point = new Point((wbMap.Width / 2) - 85, (wbMap.Height / 2) - 17); picLoadMap.Location = point; pnlHandle.Enabled = false; pnlTool.Enabled = false; picLoadMap.Visible = true; wbMap.Url = new Uri(Variable.MapUrl); tPlay.Interval = getPlaySpeed(); tPlay.Elapsed += new ElapsedEventHandler(onPlayMain); wbMap.execStopPlayTrackLine(sQueryTypeValue); tGetQueryTrackInfo = new System.Timers.Timer(2000.0); tGetQueryTrackInfo.Elapsed += new ElapsedEventHandler(tGetQueryTrackInfo_Elapsed); myGetTrackQueryInfo = new dGetTrackQueryInfo(getAddress); myPlay = new dPlay(onPlay); mySetEnable = new dEnable(onSetBtnEnable); myShowMessage = new dShowMessage(execShowMess); myPlayCnt = new dPlayCnt(exePlayCnt); initDataTable(); m_dtPlayDataCopy = m_dtPlayData.Clone(); dtpStartDate.Value = DateTime.Now; dtpEndDate.Value = DateTime.Now; //2015.5.23 dt = dal.GetList("", ""); if (dt != null && dt.Rows.Count > 0) { string[] str = new string[3]; dat = new DataTable("GpsStation"); dat.Columns.Add("ID", System.Type.GetType("System.String")); dat.Columns.Add("lng", System.Type.GetType("System.String")); dat.Columns.Add("lat", System.Type.GetType("System.String")); dat.Columns.Add("dis", System.Type.GetType("System.String")); int index = 0; foreach (DataRow dr in dt.Rows) { str = dr["RegionDot"].ToString().Split(new char[] { '\\' }); DataRow dRow = dat.NewRow(); dRow["ID"] = index; dRow["lng"] = str[0]; dRow["lat"] = str[1]; dRow["dis"] = str[2].TrimEnd(new char[] { '*' }); dat.Rows.Add(dRow); index++; } } }
private void itmCarPlayTrack_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.FormOwnerClosing) { if (m_bPlay) { MessageBox.Show("请先结束播放!"); e.Cancel = true; } else { try { if (IsFlagChanged) { MainForm.myMap.execClearAllFlag(); MainForm.myMap.showFlagMap(MainForm.myMap.wbMap); } WaitForm.Hide2(); wbMap.Stop(); wbMap = null; m_bPlay = false; tPlay.Stop(); tPlay.Dispose(); if (m_dsReplayData != null) { m_dsReplayData.Clear(); m_dsReplayData = null; } if (m_dtPlayData != null) { m_dtPlayData.Clear(); m_dtPlayData = null; } if (m_dtPlayDataCopy != null) { m_dtPlayDataCopy.Clear(); m_dtPlayDataCopy = null; } if (m_dvPlayData != null) { m_dvPlayData.Dispose(); m_dvPlayData = null; } if (myPlay != null) { myPlay = null; } if (mySetEnable != null) { mySetEnable = null; } if (tGetReplayData.ThreadState != ThreadState.Stopped) { tGetReplayData.Abort(); } if (wbMap != null) { wbMap.execStopPlayTrackLine(sQueryTypeValue); } } catch (ThreadAbortException) { Thread.Sleep(500); Thread.ResetAbort(); } catch (Exception exception) { Record.execFileRecord("轨迹回放窗口关闭", exception.Message); } finally { GC.SuppressFinalize(this); } } } }