private void AddCore(DownloadLink link) { var tokeSource = new CancellationTokenSource(); var tasks = link.Downloader.EmitTasks(link.Request, tokeSource.Token); var downloadTask = new DownloadTask(tasks, tokeSource.Token); var box = new DownloadBox(downloadTask, link) { TokenSource = tokeSource }; box.Canceled += Box_Canceled; downloadTask.MovedNext += (a, b) => { MovedNext?.Invoke(this, a, b); }; downloadTask.Seeked += (a, b) => { Seeked?.Invoke(this, a, b); }; downloadTask.Done += async w => { await RemoveAsync(box.Address); Done?.Invoke(this, box); }; downloadMap.Add(link.Request.Entity.ComicUrl, box); downloadManager.Add(downloadTask); Added?.Invoke(this, box); }
private void handleSeeked(global::Dbus.MessageHeader header, byte[] body) { assertSignature(header.BodySignature, "x"); var decoderIndex = 0; var decoded0 = global::Dbus.Decoder.GetInt64(body, ref decoderIndex); Seeked?.Invoke(decoded0); }
private void Grid_MouseUp(object sender, MouseButtonEventArgs e) { var clickPositionX = Mouse.GetPosition((ProgressBar)sender).X; var gridWidth = ((ProgressBar)sender).RenderSize.Width; double targetFraction = clickPositionX / gridWidth; Seeked?.Invoke(targetFraction); }
public Task NotifySeeked() { if (Seeked != null) { return(Seeked.Invoke()); } return(Task.CompletedTask); }
public void Seek(int pos) { if (pos >= Max || pos < -1) { throw new ArgumentOutOfRangeException(pos.ToString()); } Volatile.Write(ref position, pos); Seeked?.Invoke(this, pos); }
public void Seek(double TrackPercent) { if (CurrentTrack == null) { return; } if (TrackPercent < 0 || TrackPercent > 1) { return; } TimeSpan targetTime = _waveSource.GetLength() * TrackPercent; _waveSource.SetPosition(targetTime); Seeked?.Invoke(TrackPercent); }