gpt4 book ai didi

axapta - FormRun.wait() : method is deprecated, 使用什么代替?

转载 作者:行者123 更新时间:2023-12-01 19:57:50 29 4
gpt4 key购买 nike

我目前正在修复一个更大项目的一些最佳实践警告。我有一些实例,在执行更多操作之前调用并等待表单,这主要是一些对话框。为了等待表单,经常使用以下代码:

Object formRun;

//declare args and stuf...
formRun = classfactory.formRunClass(args);
formRun.init();

//call methods on formRun (display,run,etc...)

formRun.wait();

我现在面临的问题是“wait()”似乎已被弃用,我不知道如何替换或修复它。我看到一些开发人员将表单声明为“对象”以消除此警告(顺便说一句,这不起作用,这仍然会被检测到),但这是一个后期绑定(bind)调用,也应该避免。 ..

还有其他人遇到过这个问题吗?我尝试使用 system.reflection 命名空间调用此方法,但这看起来不太正确,而且 x++ 中的代码比这样一个简单任务所需的代码多得多。

最佳答案

TLDR

我认为这是最佳实践检查的误报。要消除最佳实践警告,您可以将它们添加到抑制的最佳实践列表中,或在代码中添加最佳实践抑制。

详细信息

Deprecated APIs (June 2017)它表示 Objectwait 方法:

Overview

Used to block and wait for an interaction/operation and notify to unblock.

Reason for deprecation

These calls are deprecated for all objects except formRun and it’s derivatives.

Migration notes

Calls to these APIs from formRun or it’s derivatives are allowed. Calls to these APIs from any other object should be removed.

当您执行 metadata search 时对于 code:"formRun.wait()",您还会得到很多结果(8.0 版本上超过 1000 个)。这进一步表明 FormRun 并未弃用该方法。

也就是说,您可能需要查看以下链接,其中提到了可以添加事件处理程序的 formRun.lifecycleHelper()。到目前为止,我还没有亲自尝试过这一点,但它可能适用于您的情况。

FormRun.wait, Box and ChangeCompany - a poor cocktail

关于axapta - FormRun.wait() : method is deprecated, 使用什么代替?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55064234/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com