public Form ExcecutePlugin(string pluginName, ref DataAccess woabotStats, Connection conn)
        {
            foreach (var op in operations)
            {

                if (op.Name == pluginName)
                {
                    try
                    {
                        return op.Excecute(ref woabotStats, conn);
                    }
                    catch (Exception ex)
                    {
                        woabotStats.EventLog.Insert("Plugin Importer", "Error", ex.ToString(), true);
                    }
                }
            }

            return null;
        }
        public Form PluginSettings(string pluginName, ref DataAccess woabotStats)
        {
            foreach (var op in operations)
            {
                if (op.Name == pluginName)
                {
                    try
                    {
                        return op.Settings();
                    }
                    catch (Exception ex)
                    {
                        woabotStats.EventLog.Insert("Plugin Importer", "Error", ex.ToString(), true);
                    }
                }
            }

            return null;
        }
 public Form Excecute(ref DataAccess woabotStats, Connection conn)
 {
     ManualDrive f = new ManualDrive(conn);
     return f;
 }
 public Form Excecute(ref DataAccess woabotStats, Connection conn)
 {
     ObstacleAvoidance t = new ObstacleAvoidance(conn);
     t.OnAllStop += ObstacleAvoidance_OnAllStop;
     return t;
 }
        public Console()
        {
            InitializeComponent();

            //reset form
            IsConnected = false;

            //stats log
            //data = new DataAccess(Properties.Settings.Default.WoabotStatsDB);
            data = new DataAccess();
            data.EventLog.OnInsert += new EventLog.EventHandler(EventLog_OnInsert);

            //connect phidgets
            manager = new Phidgets.Manager();
            manager.Attach += new Phidgets.Events.AttachEventHandler(manager_Attach);
            manager.Detach += new Phidgets.Events.DetachEventHandler(manager_Detach);
            manager.Error += new Phidgets.Events.ErrorEventHandler(manager_Error);
            manager.ServerConnect += new Phidgets.Events.ServerConnectEventHandler(manager_ServerConnect);
            manager.ServerDisconnect += new Phidgets.Events.ServerDisconnectEventHandler(manager_ServerDisconnect);
            manager.close();

            //load plugings
            plugings = new PluginImporter.Importer();
            plugings.DoImport();
            plugings.HookEvents();

            //add menu item to run each plugin

            if (plugings.AvailableNumberOfOperations > 0)
            {
                foreach (PluginImporter.Importer.PluginDescription plugin in plugings.ListAllPlugins())
                {
                    ToolStripMenuItem item = new ToolStripMenuItem();
                    item.Text = plugin.Name;
                    item.ToolTipText = plugin.Description;
                    item.Tag = plugin;
                    item.Click += new EventHandler(item_Click);
                    pluginsToolStripMenuItem.DropDownItems.Add(item);

                    if (plugin.AddToolStripItem)
                    {
                        ToolStripButton button = new ToolStripButton();
                        button.ToolTipText = plugin.Name + " - " + plugin.Description;
                        button.Image = plugin.ToolStripItemImage;
                        button.Tag = plugin;
                        button.Click += new EventHandler(button_Click);
                        button.Enabled = IsConnected;
                        toolStrip.Items.Add(button);

                    }

                    if (plugin.AddSettingsMenuItem)
                    {
                        ToolStripMenuItem setting = new ToolStripMenuItem();
                        setting.Text = plugin.Name;
                        setting.Tag = plugin;
                        setting.Click += new EventHandler(setting_Click);
                        toolsMenu.DropDownItems.Add(setting);
                    }

                }
            }
        }