コード例 #1
0
ファイル: LegacyDBUploder.cs プロジェクト: ddanninger/PLMPack
 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);
 }
コード例 #2
0
ファイル: LegacyDBUploder.cs プロジェクト: ddanninger/PLMPack
 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)
                ));
 }
コード例 #3
0
        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;
        }
コード例 #4
0
        public string GetFilePathFromGuid(Guid guid)
        {
            DCComponent comp = GetComponent(guid);

            return(FileTransferUtility.DownloadFile(comp.File.Guid, comp.File.Extension));
        }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: ddanninger/PLMPack
 private void clearFileCacheToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try { FileTransferUtility.ClearFileCache(); }
     catch (Exception ex)  { _log.Error(ex.Message); }
 }