/// <summary> /// Initiate rendering process with the given <see cref="CXO2.Charting.Chart"/>. /// </summary> /// <param name="chart"><see cref="Charting.Chart"/> to render.</param> public async void Render(Chart chart) { // Wait task to complete and dispose current chart if (task?.Status == TaskStatus.Running) { await task; } // Validate chart Chart = chart; if (Chart == null || Chart.Events == null || Chart.Events.Length == 0) { throw new Exception("No events to be rendered."); } // Reset stats Measure = 0; Beat = 0; Cell = 0; Elapsed = TimeSpan.Zero; Duration = Chart.Duration; BPM = Chart.BPM; IsRendering = true; startTick = DateTime.Now.Ticks; bpmOffset = 0; timeOffset = 0; pausedOffset = 0; RenderStart?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Raises event 'RenderStart' /// </summary> protected virtual void OnRenderStart() { if (RenderStart != null) { RenderStart.Invoke(this, System.EventArgs.Empty); } }