void onEndReachedEvent(CurvySplineMoveEventArgs e) { if (!(_active == this)) { return; } if (e.Spline && e.Spline != Spline) { e.Spline.OnMoveEndReached.RemoveListener(onEndReachedEvent); } else { e.Sender = this; OnEndReached.Invoke(e); } }
/// <summary> /// Start automatically consuming message and trigger events. /// /// Will invoke OnMessage, OnEndReached and OnConsumerError events. /// </summary> public void Start() { if (consumerTask != null) { throw new InvalidOperationException("Consumer task already running"); } consumerCts = new CancellationTokenSource(); var ct = consumerCts.Token; consumerTask = Task.Factory.StartNew(() => { while (!ct.IsCancellationRequested) { var messageAndError = Consume(TimeSpan.FromSeconds(1)); if (messageAndError.HasValue) { var mae = messageAndError.Value; if (mae.Error == ErrorCode.NO_ERROR) { OnMessage?.Invoke(this, mae.Message); } else if (mae.Error == ErrorCode._PARTITION_EOF) { OnEndReached?.Invoke(this, new TopicPartitionOffset() { Topic = mae.Message.Topic, Partition = mae.Message.Partition, Offset = mae.Message.Offset, }); } else { OnConsumerError?.Invoke(this, mae.Error); } } } }, ct, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
private void EmOnOnEndReached() { OnEndReached?.Invoke(); }
private void Instance_MediaEnded(object sender, RoutedEventArgs e) { OnEndReached?.Invoke(); OnStopped?.Invoke(this); }
private void EndReached(object sender, EventArgs e) { OnEndReached?.Invoke(); _appWebServer.OnEndReached?.Invoke(); }