예제 #1
0
 private void TransferManagerTransferUploadItemError(object sender, UploadItemEventArgs e)
 {
     if (Settings.UploadSourceQualityEnabled)
     {
         FileSourceManager.RegisterError(e.UploadItem.SystemPath);
     }
 }
예제 #2
0
        private void OnUploadItemRequest(UploadItemEventArgs e)
        {
            var handler = TransferUploadItemRequest;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #3
0
        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);
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
 private void UploadItemError(object sender, UploadItemEventArgs e)
 {
     OnUploadItemError(e);
 }
예제 #7
0
 void UploadItemRequest(object sender, UploadItemEventArgs e)
 {
     OnUploadItemRequest(e);
 }
예제 #8
0
 private void TransferUploadItemDisposeHandler(object sender, UploadItemEventArgs e)
 {
     OnTransferUploadItemDispose(e);
 }
 private void uploadControl_FileUploadCompleted(object sender, UploadItemEventArgs e)
 {
     ShowPreview(e.ItemInfo);
 }
예제 #10
0
 void TransferManager_TransferUploadItemRequest(object sender, UploadItemEventArgs e)
 {
     FileSourceManager.RegisterRequest(e.UploadItem.SystemPath);
 }
예제 #11
0
 protected virtual void OnRequest(UploadItemEventArgs e)
 {
     e.UploadItem = this;
     Request?.Invoke(this, e);
 }
예제 #12
0
 protected void OnError(UploadItemEventArgs e)
 {
     e.UploadItem = this;
     Error?.Invoke(this, e);
 }