コード例 #1
0
        public void OpenPlugin(string pluginName, OpenMruPluginEventArgs e = null)
        {
            if (e != null)
            {
                pluginName = e.Item.PluginName;
            }
            var plugin = pluginsManager.ValidatedPlugins.FirstOrDefault(p => PluginFinderByIdOrName(p, pluginName));

            if (plugin == null)
            {
                var message = $"Tool '{pluginName}' was not found.\n\nYou can install it from the Tool Library";
                MessageBox.Show(this, message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            OpenPluginRequested?.Invoke(this, e != null ? new PluginEventArgs(e, plugin) : new PluginEventArgs(plugin));
        }
コード例 #2
0
        public void DuplicateTool(string pluginName, IDuplicatableTool sourceTool, object state, OpenMruPluginEventArgs e = null)
        {
            if (e != null)
            {
                pluginName = e.Item.PluginName;
            }

            var plugin = pluginsManager.ValidatedPluginsExt.FirstOrDefault(p => p.Metadata.Name == pluginName);

            if (plugin == null)
            {
                var message = $"Tool '{pluginName}' was not found.\n\nYou can install it from the Tool Library";
                MessageBox.Show(this, message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            OpenPluginRequested?.Invoke(this, e != null ? new PluginEventArgs(e, plugin)
            {
                SourceTool = sourceTool, State = state
            } : new PluginEventArgs(plugin)
            {
                SourceTool = sourceTool, State = state
            });
        }
コード例 #3
0
 private void Ctrl_OpenMruPluginRequested(object sender, OpenMruPluginEventArgs e)
 {
     OpenMruPluginRequested?.Invoke(sender, e);
 }