private void Upload(string filePath, Guid g, IProcessingCallback callback) { if (null != callback) { callback.Info(string.Format(_actuallyUpload ? "Uploading {0}..." : "Not actually uploading {0}...", Path.GetFileName(filePath))); } FileTransferUtility.UploadFile(filePath, g); }
private PLMPackSR.DCFile Upload(string filePath, IProcessingCallback callback, PLMPackSR.PLMPackServiceClient client) { if (null != callback) { callback.Info(string.Format(_actuallyUpload ? "Uploading {0}..." : "Not actually uploading {0}...", Path.GetFileName(filePath))); } return(client.CreateNewFile( _actuallyUpload ? FileTransferUtility.UploadFile(filePath) : Guid.NewGuid() , Path.GetExtension(filePath) )); }
private void timer_Tick(object sender, EventArgs e) { NodeTag[] listTreeNodes = _currentNodeTag.Chidrens; if (i == listTreeNodes.GetLength(0)) { timer.Stop(); return; } Image image; SizeF sizef; try { image = Image.FromFile(FileTransferUtility.DownloadFile(listTreeNodes[i].Thumbnail.Guid, listTreeNodes[i].Thumbnail.Extension)); sizef = new SizeF(image.Width / image.HorizontalResolution, image.Height / image.VerticalResolution); float fScale = Math.Min(cxButton / sizef.Width, cyButton / sizef.Height); sizef.Width *= fScale; sizef.Height *= fScale; } catch (FileTransferException ex) { _log.Error(ex.Message); ++i; return; } catch (Exception ex) { _log.Error(ex.ToString()); ++i; return; } // convert image to small size for button Bitmap bitmap = new Bitmap(image, Size.Ceiling(sizef)); image.Dispose(); // create button and add to panel Button btn = new Button(); btn.Image = bitmap; btn.Location = new Point(x, y) + (Size)AutoScrollPosition; btn.Size = new Size(cxButton, cyButton); btn.Tag = listTreeNodes[i]; btn.Click += new EventHandler(btn_Click); Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn, String.Format("{0}\n{1}", listTreeNodes[i].Name, listTreeNodes[i].Description)); // adjust i, x and y for next image AdjustXY(ref x, ref y); ++i; }
public string GetFilePathFromGuid(Guid guid) { DCComponent comp = GetComponent(guid); return(FileTransferUtility.DownloadFile(comp.File.Guid, comp.File.Extension)); }
private void clearFileCacheToolStripMenuItem_Click(object sender, EventArgs e) { try { FileTransferUtility.ClearFileCache(); } catch (Exception ex) { _log.Error(ex.Message); } }