BackgroundWorker 프로세스가 완료되었을 때 양식을 숨기는 데 문제가 있습니다. '제출'버튼을 누른 후BackgroundWorker 완료시 양식 창 숨기기
private void submitButton_Click(object sender, EventArgs e)
{
processing f2 = new processing();
f2.MdiParent = this.ParentForm;
f2.StartPosition = FormStartPosition.CenterScreen;
f2.Show();
this.Hide();
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
// loop through and upload our sound bits
string[] files = System.IO.Directory.GetFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\wav", "*.wav", System.IO.SearchOption.AllDirectories);
foreach (string soundBit in files)
{
System.Net.WebClient Client = new System.Net.WebClient();
Client.Headers.Add("Content-Type", "audio/mpeg");
byte[] result = Client.UploadFile("http://mywebsite.com/upload.php", "POST", soundBit);
}
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
formSubmitted f3 = new formSubmitted();
f3.MdiParent = this.ParentForm;
f3.StartPosition = FormStartPosition.CenterScreen;
f3.Show();
this.Hide();
}
기본적으로, 응용 프로그램은 PHP 스크립트를 통해 웹 서버에 파일을 업로드하기 시작합니다. 업로드가 완료되면 RunWorkerCompleted 메서드가 트리거되어 formSubmitted
폼이 열립니다. 내가 겪고있는 문제는 backgroundworker가 완료되고 formSubmitted
이 바로 processing
양식의 맨 위에 열리면 processing
양식이 닫히지 않는다는 것입니다. 원하는대로, processing
양식을 닫은 다음 formSubmitted
양식을 엽니 다.
시도는 다음과 같습니다 :
는 위의 모든 방법을 포함한 클래스 (무엇입니까 '이 '가 참조하는)? –
클래스는'uploadPanel'입니다. – Spencer