async public Task <bool> SetAioOutputVoltage(int index, float[] voltage)//left:0 ,right:1 { bool result = await Task.Run(() => { if (voltage.Length != 2) { return(false); } for (int i = 0; i < 2; i++) { if (Math.Abs(voltage[i]) >= 3.0) { System.Console.WriteLine("over voltage"); return(false); } } //アナログ出力 int Ret = 0; Ret = aio.MultiAoEx(aioId[index], 2, voltage); if (Ret != 0) { string ErrorString; aio.GetErrorString(Ret, out ErrorString); //label_Information.Text = "aio.MultiAoEx = " + Ret.ToString() + " : " + ErrorString; return(false); } System.Console.Write("W:{0} S:{1} ", voltage[0], voltage[1]); //Task.Delay(1000); return(true); }); return(result); }