我完全不知道从哪里开始。
这是我无法通过的代码行。
if (error.GetReaction(ErrorReaction.InformUser) == null)
{
error.SetReaction(new ErrorReactionClass(ErrorReaction.InformUser, (CachedAnonymousMethodDelegate1 != null) ? CachedAnonymousMethodDelegate1 : (CachedAnonymousMethodDelegate1 = new Method(ErrorMessageBox.ShowDialog)), "OK", ""));
}
我从这个
中得到以下错误错误30'System.Windows.Forms.DialogResult System.Windows.Forms.Form.ShowDialog()'返回类型错误
错误31非静态字段,方法或属性'System.Windows.Forms.Form.ShowDialog()'
答案 0 :(得分:1)
这里有两个错误。
我怀疑这可能会满足您的需求:
// Not sure how many arguments your "Method" delegate gets
Method showDialog = (arg1, arg2) =>
{
var form = new ErrorMessageBox();
// Setup form with arg1/arg2/etc
form.ShowDialog();
// return appropriate return type here...
};
error.SetReaction(
new ErrorReactionClass(
ErrorReaction.InformUser,
(CachedAnonymousMethodDelegate1 != null)
? CachedAnonymousMethodDelegate1
: (CachedAnonymousMethodDelegate1 = showDialog)
, "OK", ""));