示例#1
0
        private void btfile_Click(object sender, EventArgs e)
        {
            typeSent = DataType.File;
            Thread t = new Thread(new ThreadStart(ChosefileDialog));

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
        }
示例#2
0
        private void ChosefileDialog()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = false;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string s = dialog.FileName;
                tbText.Text = s;

                System.IO.FileInfo info = new System.IO.FileInfo(s);
                filename = info.Name;
                filepath = info.DirectoryName;
            }
            else
            {
                typeSent = DataType.Text;
            }
        }
示例#3
0
 private void tbText_Click(object sender, EventArgs e)
 {
     typeSent = DataType.Text;
 }