提示コードですが///
コメント部内部のコードで以下のエラーが出るのですがこれはどうやって対処したらいいのでしょうか?
デリゲート 'Action' には引数 2 を指定できません
とありますが二つの引数を設定したい場合が知りたいです。
エラー CS1593 デリゲート 'Action' には引数 2 を指定できません
cs
1 2 private async void buttonConvert_Click(object sender, EventArgs e) 3 { 4 5 Action<SemaphoreSlim,FileData> action = (SemaphoreSlim slim,FileData data) => 6 { 7 8 //Process(slim, data.getFilePath(),data.getSavePath()); 9 10 this.Invoke((Action)(() => 11 { 12 progressBar_float += progressBarPerFile; 13 progressBar.Value = (int)progressBar_float; 14 })); 15 16 }; 17 18 if (folderBrowserDialogSavePath.SelectedPath != "") 19 { 20 if(filePathList.Count > 0) 21 { 22 progressBarPerFile = 100.0f / (float)filePathList.Count; //プログラスバーを設定 23 24 buttonConvert.Enabled = false; 25 Stopwatch sw = new Stopwatch(); 26 sw.Start(); 27 var slim = new SemaphoreSlim(5); 28 29 for(int j = 0; j < filePathList.Count; j++) 30 { 31 ///////////////////////////////////////////////////////////////// 32 taskList.Add(Task.Factory.StartNew((slim,data) => 33 { 34 35 //Process(slim, data.getFilePath(),data.getSavePath()); 36 37 this.Invoke((Action)(() => 38 { 39 progressBar_float += progressBarPerFile; 40 progressBar.Value = (int)progressBar_float; 41 })); 42 43 } )); 44 ////////////////////////////////////////////////////////////////// 45 } 46 47 48 49 50 51 52 await Task.WhenAll(taskList); 53 buttonConvert.Enabled = true; 54 55 progressBar.Value = 0; 56 sw.Stop(); 57 TimeSpan ts = sw.Elapsed; 58 59 Debug.WriteLine("convert time: " + ts.TotalSeconds +"."+ ts.Milliseconds); 60 } 61 else 62 { 63 MessageBox.Show("NO input file(s)", "", MessageBoxButtons.OK, MessageBoxIcon.Error); 64 } 65 } 66 else 67 { 68 MessageBox.Show("\n\n NO set save path", "", MessageBoxButtons.OK, MessageBoxIcon.Error); 69 } 70 71 } 72 73
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。