示例#1
0
        public void Run(WaitHandle waitBeforePlayHandle, CancellationToken token)
        {
            var res = RunInternal(waitBeforePlayHandle, token);

            if (!res.Ok)
            {
                Log.Trace($"{this}: Failed ({res.Error}).");
                OnLoadFailure?.Invoke(this, new LoadFailureEventArgs(res.Error, QueueItem));
            }
            else
            {
                Log.Trace($"{this}: Finished.");
            }
        }
示例#2
0
        private void RunActualTask(CancellationToken token)
        {
            var timer = new Stopwatch();

            timer.Start();
            var res = StartBackground(QueueItem, waitForStartPlayHandle, token);

            if (!res.Ok)
            {
                Log.Debug($"Task {GetHashCode()}: Failed ({res.Error})");
                OnLoadFailure?.Invoke(this, new LoadFailureEventArgs(res.Error));
            }
            else
            {
                Log.Debug($"Task {GetHashCode()}: Start song took {timer.ElapsedMilliseconds}ms");
            }
        }
示例#3
0
 protected void InvokeOnLoadFailure(object sender, LoadFailureTaskEventArgs e)
 {
     RemoveFinishedTask();
     OnLoadFailure?.Invoke(sender, e);
 }