Beispiel #1
0
        /// <summary>
        /// 文件被接收时触发事件
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnFileSendAccept(FileSendEventArgs e)
        {
            FileTransfersItem item =
                e.SendFileManager.Tag as FileTransfersItem;

            if (item != null)
            {
                Form.ActiveForm.BeginInvoke(new MethodInvoker(delegate()
                {
                    item.Start();
                }));
            }
            if (FileSendAccept != null)
            {
                FileSendAccept(this, e);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 保存文件按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemSaveButtonClick(object sender, EventArgs e)
        {
            FileTransfersItem        item = sender as FileTransfersItem;
            RequestSendFileEventArgs rse  = item.Tag as RequestSendFileEventArgs;

            //自动保存在程序根目录下
            rse.Path = Application.StartupPath;
            ControlTag tag = new ControlTag(
                rse.TraFransfersFileStart.MD5,
                rse.TraFransfersFileStart.FileName,
                rse.RemoteIP);

            item.Tag                = tag;
            item.Style              = FileTransfersItemStyle.Receive;
            item.CancelButtonClick += new EventHandler(ItemCancelButtonClick);
            item.Start();
            this.AcceptReceive(rse);
        }
Beispiel #3
0
        /// <summary>
        /// 文件另存为按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemSaveToButtonClick(object sender, EventArgs e)
        {
            FileTransfersItem        item = sender as FileTransfersItem;
            RequestSendFileEventArgs rse  = item.Tag as RequestSendFileEventArgs;
            FolderBrowserDialog      fbd  = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                rse.Path = fbd.SelectedPath;
                ControlTag tag = new ControlTag(
                    rse.TraFransfersFileStart.MD5,
                    rse.TraFransfersFileStart.FileName,
                    rse.RemoteIP);
                item.Tag                = tag;
                item.Style              = FileTransfersItemStyle.Receive;
                item.CancelButtonClick += new EventHandler(ItemCancelButtonClick);
                item.Start();

                this.AcceptReceive(rse);
            }
        }