Esempio n. 1
0
        public void OpenPlugin(string pluginName)
        {
            var plugin = pluginsManager.ValidatedPlugins.FirstOrDefault(p => p.Metadata.Name == pluginName);

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

            OpenPluginRequested?.Invoke(this, new PluginEventArgs(plugin));
        }
 private void Pm_Clicked(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         OpenPluginRequested?.Invoke(this, new PluginEventArgs((PluginModel)sender));
     }
     else if (e.Button == MouseButtons.Right)
     {
         if (sender is PluginModel ctrl)
         {
             selectedPluginModel = ctrl;
             cmsOnePlugin.Show(Cursor.Position);
         }
     }
 }
        private void txtSearch_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                var name   = ((TextBox)sender).Text.ToLower();
                var plugin = pluginsManager.ValidatedPluginsExt.FirstOrDefault(p => p.Metadata.Name.ToLower().Contains(name));

                if (plugin != null)
                {
                    OpenPluginRequested?.Invoke(this, new PluginEventArgs(plugin));

                    // Clear the textbox
                    txtSearch.Text = string.Empty;
                }
            }
        }
Esempio n. 4
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));
        }
        private void cmsOnePlugin_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var plugin = (Lazy <IXrmToolBoxPlugin, IPluginMetadataExt>)selectedPluginModel.Tag;

            if (e.ClickedItem == tsmiOpenProjectHomePage)
            {
                OpenPluginProjectUrlRequested?.Invoke(this, new PluginEventArgs(selectedPluginModel));
            }
            else if (e.ClickedItem == tsmiUninstallPlugin)
            {
                UninstallPluginRequested?.Invoke(this, new PluginEventArgs(selectedPluginModel));
            }
            else if (e.ClickedItem == tsmiHidePlugin)
            {
                Options.Instance.HiddenPlugins.Add(plugin.Metadata.Name);
                ReloadPluginsList();
            }
            else if (e.ClickedItem == tsmiShortcutTool)
            {
                CreateShortcut(plugin.Metadata.Name);
            }
            else if (e.ClickedItem == tsmiShortcutToolConnection)
            {
                CreateShortcut(plugin.Metadata.Name, ConnectionDetail?.ConnectionName);
            }
            else if (e.ClickedItem == tsmiAddToFavorites)
            {
                AddToFavorites(plugin.Metadata.Name);
            }
            else if (e.ClickedItem == tsmiOpenWithNewConection)
            {
                OpenPluginRequested?.Invoke(this, new PluginEventArgs(plugin)
                {
                    NeedNewConnection = true
                });
            }
        }
        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
            });
        }
Esempio n. 7
0
 private void Ctrl_OpenFavoritePluginRequested(object sender, OpenFavoritePluginEventArgs e)
 {
     OpenPluginRequested?.Invoke(this, new OpenFavoritePluginEventArgs(e.Item));
 }