Winforms、C#、VS2010。outパラメータを持つcontrol.invoke
私は自分のアプリの生涯にわたって実行されるポーリングスレッドを持っています。
時折、私のメインフォームでイベントを呼び出します。私は何年もコードに触れていないし、正常に実行されましたが、今はパラメータのリストに "out"パラメータを追加する必要があります。私はオンラインで検索しましたが、私が見つけたすべてのスレッドは、リフレクションに関するもので、私のコンテキストに変換しようとすると複雑でした。私は反射を使用しません。
誰かがこのplsを修正する方法を手伝ってもらえますか?リフレクションスレッドでは、人々は、私のコードで使用していないoutパラメータ結果のためにオブジェクト配列をチェックするように見えますが、とにかくそれを取得する場所はわかりません。
private bool OnNeedUpdateCreateEvent(string title, string message,
bool creatingNew, out string newPlanName)
{
newPlanName = "";
// 1st pass through this function.
// Check to see if this is being called from another thread rather
// than the main thread. If so then invoke is required
if (InvokeRequired)
{
// Invoke and recall this method.
return (bool)Invoke(new onNeedToUpdatePlanEvent(OnNeedUpdateCreateEvent),
title, message, creatingNew, out newPlanName); <- wrong out param
}
else
{
// 2nd pass through this function due to invoke, or invoke not required
return InputDlg(this, title, message, creatingNew, out newPlanName);
}
}