示例#1
0
        private void mUploadFolderMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.Description         = "选择要上传的文件夹";
            dialog.ShowNewFolderButton = false;
            if (dialog.ShowDialog() != DialogResult.OK || String.IsNullOrEmpty(dialog.SelectedPath))
            {
                return;
            }

            ThreadStart threadStart = () =>
            {
                ContentPutWindow window = new ContentPutWindow();
                window.Host          = mConnector.Host;
                window.Port          = mConnector.Port;
                window.Password      = mConnector.Password;
                window.ContentPath   = dialog.SelectedPath;
                window.ContainerPath = mCurrentDirectory;
                Application.Run(window);
            };
            Thread thread = new Thread(threadStart);

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }
示例#2
0
        private void mUploadFileMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title = "选择要上传的文件";
            if (dialog.ShowDialog() != DialogResult.OK || String.IsNullOrEmpty(dialog.FileName))
            {
                return;
            }

            ThreadStart threadStart = () =>
            {
                ContentPutWindow window = new ContentPutWindow();
                window.Host          = mConnector.Host;
                window.Port          = mConnector.Port;
                window.Password      = mConnector.Password;
                window.ContentPath   = dialog.FileName;
                window.ContainerPath = mCurrentDirectory;
                Application.Run(window);
            };
            Thread thread = new Thread(threadStart);

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }