//ステータスメッセージ表示 private void statusMsg(int state, string msg) { if (msg == null) //nullならcaio絡みのメッセージとする { if (state == 0) { statusLabel2.ForeColor = Color.Black; statusLabel2.Text = "正常終了"; } else { statusLabel2.ForeColor = Color.Red; string errorString; aio.GetErrorString(state, out errorString); statusLabel2.Text = state.ToString() + "-" + errorString; return; } } else { if (state == 0) //nullでなかったらstateで色を決める。 { statusLabel2.ForeColor = Color.Black; statusLabel2.Text = msg; } else { statusLabel2.ForeColor = Color.Red; statusLabel2.Text = msg; } } }
private bool AioInit(string deviceName, out short aioId, out string returnCode) { // Initialization handling int Ret = aio.Init(deviceName, out aioId); string ErrorString; aio.GetErrorString(Ret, out ErrorString); returnCode = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString; Console.WriteLine(returnCode); if (Ret != 0) { return(false); } return(true); }