示例#1
0
        private void btnUpload_Click(object sender, EventArgs e)
        {
            FrmUploadFile dlg = new FrmUploadFile();

            dlg.UserId = this.UserId;
            dlg.OwerId = this.OwerId;
            dlg.AttachmentDirectory = this.AttachmentDirectory;
            dlg.AttachmentGUID      = this.AttachmentGUID;
            dlg.OnDataSaved        += new EventHandler(dlg_OnDataSaved);
            dlg.Show();
        }
        private void FrmAttachmentGroupView_DragDrop(object sender, DragEventArgs e)
        {
            var list = (String[])e.Data.GetData(DataFormats.FileDrop);

            if (list.Length > 0)
            {
                FrmUploadFile dlg = new FrmUploadFile();
                dlg.UserId = UserId;
                dlg.OwerId = OwerId;
                dlg.AttachmentDirectory = this.AttachmentDirectory;
                dlg.AttachmentGUID      = this.AttachmentGUID;
                dlg.OnDataSaved        += new EventHandler(dlg_OnDataSaved);

                //显示相关的文件
                dlg.txtFile.Text = string.Join(",", list);
                dlg.DisplayFiles();

                dlg.Show();
            }
            else
            {
                MessageUtil.ShowError("请选择文件");
            }
        }