void ViewEvent_VdsViewEventEvent_StopPlotScriptEventEvent(object sender, EventArgs e) { if (!PlotIsPlaying) { return; } VdsViewEventEvent.VEventArgs vArgs = e as VdsViewEventEvent.VEventArgs; string plotID = vArgs.EventParameter.ToString(); if (CurrentPlotID == plotID) { for (int i = _childrenList.Count - 1; i >= 0; i--) { VdsPlotTimeLine t = (VdsPlotTimeLine)_childrenList[i]; t.StopScript(); } PlotIsPlaying = false; PlotIsPause = false; _pauseTick = 0; _startTick = 0; (ParentObject as VdsLayer).RemoveChild(this); if (_currentView != null) { _currentView.ViewEvent.VdsViewEventEvent_PlayPlotScriptEventEvent -= ViewEvent_VdsViewEventEvent_PlayPlotScriptEventEvent; _currentView.ViewEvent.VdsViewEventEvent_StopPlotScriptEventEvent -= ViewEvent_VdsViewEventEvent_StopPlotScriptEventEvent; _currentView.ViewEvent.VdsViewEventEvent_PausePlotScriptEventEvent -= ViewEvent_VdsViewEventEvent_PausePlotScriptEventEvent; } } }
void ViewEvent_VdsViewEventEvent_PlayPlotScriptEventEvent(object sender, EventArgs e) { VdsViewEventEvent.VEventArgs vArgs = e as VdsViewEventEvent.VEventArgs; List <string> eventParameter = vArgs.EventParameter as List <string>; if (_totalLength == 0) { for (int i = _childrenList.Count - 1; i >= 0; i--) { VdsPlotTimeLine t = (VdsPlotTimeLine)_childrenList[i]; t.InitPlotTimeLine(); } } if (!PlotIsPlaying) { double offsetTime = Convert.ToDouble(eventParameter[1]); _startTick = DateTime.Now.Ticks - (long)(offsetTime * TimeSpan.TicksPerSecond); CurrentPlotID = eventParameter[0]; PlotIsPlaying = true; } else if (PlotIsPause) { PlotIsPause = false; long nowTick = DateTime.Now.Ticks; _startTick = _startTick + (nowTick - _pauseTick); } }