如何在自定义操作后更新ui? [重复]

时间:2021-04-07 22:39:37

This question already has an answer here:

这个问题在这里已有答案:

I've created a custom dialog like this :

我已经创建了一个这样的自定义对话框:

如何在自定义操作后更新ui? [重复]

Notice that when the user clicks on Test Connection a custom action fires. It looks like this :

请注意,当用户单击“测试连接”时,将触发自定义操作。它看起来像这样:

如何在自定义操作后更新ui? [重复]

Here I tried to pass the DBTestResult Variable through, as a test to see if I could edit it in the function, but that didn't work - neither it seems just straight returning it as per the pic.

在这里,我尝试传递DBTestResult变量,作为测试,看看我是否可以在函数中编辑它,但这不起作用 - 它似乎只是按照图片直接返回它。

The actual custom action gets called and looks like this :

调用实际的自定义操作,如下所示:

public static string CanAuthenticate(string server, string username, string password, string DBTestResult)
        {
            DBTestResult = "It got updated";
            MessageBox.Show("Called");
            return "It got updated";
        }

I would really expect it to update the label with the string literal "It got updated" - but nothing happens, it's always null / empty string.

我真的希望它用字符串文字“它得到更新”更新标签 - 但没有任何反应,它总是空/空字符串。

What am I missing?

我错过了什么?

1 个解决方案

#1


1  

The answer to this is covered by my answer on your other question: Windows Installer UI doesn't know to update in response to arbitrary property changes, such as those that occur during a control event DoAction. Thus in order to ensure the UI updates, you have to add something that it understands, such as a control event SetProperty action that writes to the desired property.

我对你的另一个问题的答案涵盖了这个问题的答案:Windows Installer UI不知道为响应任意属性更改而更新,例如在控制事件DoAction期间发生的更改。因此,为了确保UI更新,您必须添加它理解的内容,例如写入所需属性的控件事件SetProperty操作。

#1


1  

The answer to this is covered by my answer on your other question: Windows Installer UI doesn't know to update in response to arbitrary property changes, such as those that occur during a control event DoAction. Thus in order to ensure the UI updates, you have to add something that it understands, such as a control event SetProperty action that writes to the desired property.

我对你的另一个问题的答案涵盖了这个问题的答案:Windows Installer UI不知道为响应任意属性更改而更新,例如在控制事件DoAction期间发生的更改。因此,为了确保UI更新,您必须添加它理解的内容,例如写入所需属性的控件事件SetProperty操作。