首页 > 解决方案 > 在关闭时将触发器/事件从插件传递到主应用程序

问题描述

所以我有一个运行简单“插件选择”的程序。为了方便使用,当插件加载时,我将原始申请表设为不可见。

问题是当插件关闭时,我想不出一种方法将触发器传递回原始应用程序以检查插件是否关闭,然后使主应用程序再次可见(或者为简单起见,只需关闭) .

我的第一次尝试并不顺利:

// Looks for the instance of the plugin, and loads the instance, and opens the Form in that instance
if (LoadPlugin(plugin))
{
    // While the instanced plugin Form is visible 
    while (Global.Plugins.AvailablePlugins.Find(plugin).Instance.PluginForm.Visible)
    {
        // Makes this form invisible, to maintain the parent Application instance to host the Plugin
        this.Visible = false;
    }
    // When the plugin form closes, close this form, and end the program.
    this.Close();
}

标签: c#pluginstriggers

解决方案


推荐阅读