private void TransferManagerTransferUploadItemError(object sender, UploadItemEventArgs e) { if (Settings.UploadSourceQualityEnabled) { FileSourceManager.RegisterError(e.UploadItem.SystemPath); } }
private void OnUploadItemRequest(UploadItemEventArgs e) { var handler = TransferUploadItemRequest; if (handler != null) { handler(this, e); } }
protected virtual void OnTransferUploadItemDispose(UploadItemEventArgs e) { var handler = TransferUploadItemDispose; if (handler != null) { handler(this, e); } }
// Handles the FileUploadCompleted event to show a preview image. void FileUploadCompletedHandler(object sender, UploadItemEventArgs e) { string path = GetPath(uploadControl.WebHandlerUri, uploadControl.UploadServerPath, e.ItemInfo.Name); ImageSource source = new BitmapImage() { UriSource = new Uri(path) }; uploadControl.ShowPreviewImage(e.ItemInfo, source); }
private void TransferUploadItemNeededHandler(object sender, UploadItemEventArgs e) { OnTransferUploadItemNeeded(e); if (!e.Handled) { if (string.IsNullOrEmpty(e.Content.Magnet.TTH)) { if (e.Content.Magnet.FileName == "files.xml.bz2") { // asked for file list } } else { var share = _engine.Share; if (share == null) { return; } var results = share.Search(new SearchQuery { Query = e.Content.Magnet.TTH, SearchType = SearchType.TTH }, 1); if (results.Count == 1) { e.UploadItem = new UploadItem(results[0], _engine.Settings.FileReadBufferSize); } } } if (e.UploadItem != null) { if (e.UploadItem.Content.SystemPaths != null && e.UploadItem.Content.SystemPaths.Length > 1) { e.UploadItem.SystemPath = _engine.FileSourceManager.GetBestSource(e.UploadItem); } e.UploadItem.EnableRequestEventFire = _engine.Settings.UploadSourceQualityEnabled; e.UploadItem.Error += UploadItemError; e.UploadItem.Disposed += UploadItemDisposed; e.UploadItem.Request += UploadItemRequest; } }
private void UploadItemError(object sender, UploadItemEventArgs e) { OnUploadItemError(e); }
void UploadItemRequest(object sender, UploadItemEventArgs e) { OnUploadItemRequest(e); }
private void TransferUploadItemDisposeHandler(object sender, UploadItemEventArgs e) { OnTransferUploadItemDispose(e); }
private void uploadControl_FileUploadCompleted(object sender, UploadItemEventArgs e) { ShowPreview(e.ItemInfo); }
void TransferManager_TransferUploadItemRequest(object sender, UploadItemEventArgs e) { FileSourceManager.RegisterRequest(e.UploadItem.SystemPath); }
protected virtual void OnRequest(UploadItemEventArgs e) { e.UploadItem = this; Request?.Invoke(this, e); }
protected void OnError(UploadItemEventArgs e) { e.UploadItem = this; Error?.Invoke(this, e); }