using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace Tester { public partial class RegistBINPanel : UserControl, IExecutePanel { public RegistBINPanel() { InitializeComponent(); } private void btnFile_Click(object sender, EventArgs e) { using (var fileDialog = new OpenFileDialog()) { fileDialog.FileName = txtFilePath.Text; if (fileDialog.ShowDialog() == DialogResult.OK) { txtFilePath.Text = fileDialog.FileName; } } } private byte[] GetBodyData() { var path = txtFilePath.Text; if (!string.IsNullOrEmpty(path)) { return File.ReadAllBytes(path); } return null; } public object[] GetObjectArg() { var res = new List(); res.Add(txtResPath.Text); res.Add(txtCntentType.Text); res.Add(GetBodyData()); res.Add(string.IsNullOrEmpty(txtDate.Text) ? null : txtDate.Text); res.Add(cbxRetain.Checked); res.Add(string.IsNullOrEmpty(txtCmp.Text) ? null : txtCmp.Text); return res.ToArray(); } } }