示例#1
0
文件: KfsTransfers.cs 项目: tmbx/kwm
        public KfsFileTransferItem(KfsFileTransfer xfer)
        {
            /* Create all subitems, without any text in them */
            CustomListViewSubItem subItem;

            subItem = new CustomListViewSubItem();
            subItem.Name = ColumnKey.Direction.ToString();
            AddCustomSubItem(subItem);

            subItem = new CustomListViewSubItem();
            subItem.Name = ColumnKey.Status.ToString();
            AddCustomSubItem(subItem);

            subItem = new CustomListViewSubItem();
            subItem.Name = ColumnKey.File.ToString();
            AddCustomSubItem(subItem);

            subItem = new CustomListViewSubItem();
            subItem.Name = ColumnKey.Progress.ToString();
            AddCustomSubItem(subItem);
            UpdateInfos(xfer);
        }
示例#2
0
文件: KfsTransfers.cs 项目: tmbx/kwm
        public void UpdateInfos(KfsFileTransfer xfer)
        {
            // Update persistant data

            OrderID = xfer.OrderID;
            Direction = xfer is KfsFileUpload;
            Status = xfer.Status;
            File = xfer.LastFullPath;
            BytesTransfered = xfer.BytesTransferred;

            if (xfer is KfsFileUpload)
            {
                BytesToTransfer = ((KfsFileUpload)xfer).Size;
            }
            else
            {
                BytesToTransfer = ((KfsFileDownload)xfer).Version.Size;
            }

            Error = xfer.Error;

            // Update subitems
            this.Name = OrderID.ToString();
            this.Text = this.Name;

            if (InError)
            {
                this.SubItems[ColumnKey.Status.ToString()].Text = "Failed";
                this.SubItems[ColumnKey.Progress.ToString()].Text = Error.Reason;
                this.ForeColor = Color.Red;
            }
            else
            {
                this.SubItems[ColumnKey.Status.ToString()].Text = Base.GetEnumDescription(Status);
                this.SubItems[ColumnKey.Progress.ToString()].Text = Base.GetHumanFileSize(BytesTransfered) + "/" + Base.GetHumanFileSize(BytesToTransfer);
                this.ForeColor = Color.Black;
            }
            this.SubItems[ColumnKey.Direction.ToString()].Text = Direction ? "U" : "D";
            this.SubItems[ColumnKey.File.ToString()].Text = File;
        }
示例#3
0
文件: KfsShare.cs 项目: tmbx/kwm
 /// <summary>
 /// This method must be called when a file transfer is removed from the
 /// share.
 /// </summary>
 public void UnregisterFileTransfer(KfsFileTransfer t)
 {
     Debug.Assert(FileTransferTree.ContainsKey(t.LastFullPath));
     if (FileTransferTree[t.LastFullPath] == 1) FileTransferTree.Remove(t.LastFullPath);
     else FileTransferTree[t.LastFullPath]--;
     RequestStatusViewUpdate("Unregister File Transfer");
 }
示例#4
0
文件: KfsTransfer.cs 项目: tmbx/kwm
 public KfsTransferError(TransferErrorType type, KfsFileTransfer fileTransfer, String reason)
 {
     Type = type;
     FileTransfer = fileTransfer;
     Reason = reason;
 }
示例#5
0
文件: KfsShare.cs 项目: tmbx/kwm
 /// <summary>
 /// This method must be called when a file transfer is added to the share.
 /// </summary>
 public void RegisterFileTransfer(KfsFileTransfer t)
 {
     if (FileTransferTree.ContainsKey(t.LastFullPath)) FileTransferTree[t.LastFullPath]++;
     else FileTransferTree[t.LastFullPath] = 1;
     RequestStatusViewUpdate("RegisterFileTransfer");
 }