/// <summary>
 /// When the user doulbe clicks on a tool call this method
 /// </summary>
 public override bool DoubleClick()
 {
     ToolDialog td = new ToolDialog(_tool, base.ModelElements);
     td.ShowDialog();
     if (td.DialogResult == System.Windows.Forms.DialogResult.OK)
         return true;
     return false;
 }
 /// <summary>
 /// Updates the status indicator
 /// </summary>
 public void updateStatus()
 {
     ToolDialog td = new ToolDialog(_tool, base.ModelElements);
     _toolStatus = td.ToolStatus;
 }
        /// <summary>
        /// When the user double clicks one of the tools this event fires
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDoubleClick(EventArgs e)
        {
            base.OnDoubleClick(e);

            // Get the node at the current mouse pointer location.
            TreeNode theNode = GetNodeAt(PointToClient(Cursor.Position).X, PointToClient(Cursor.Position).Y);
           
            // Checks if the user double clicked a node and not a white spot
            if ((theNode != null))
            {
                // checks if the user clicked a tool or a category
                if (_toolInfoList.ContainsKey(theNode.Name))
                {

                    //We Generate an instance of the tool and dialog box to go with it
                    ITool toolToExecute = NewTool(theNode.Name);
                    toolToExecute.WorkingPath = _tempPath;
                    ToolDialog td = new ToolDialog(toolToExecute, DataSets);
                    DialogResult tdResult = td.ShowDialog(this);
                    while (tdResult == DialogResult.OK && td.ToolStatus != ToolStatus.Ok)
                    {
                        MessageBox.Show(MessageStrings.ToolSetupIncorectly);
                        tdResult = td.ShowDialog(this);
                    }
                    if (tdResult == DialogResult.OK && td.ToolStatus == ToolStatus.Ok)
                    {
                        //This fires when the user clicks the "OK" button on a tool dialog
                        //First we create the progress form
                        ToolProgress progForm = new ToolProgress(1);

                        //We create a background worker thread to execute the tool
                        BackgroundWorker bw = new BackgroundWorker();
                        bw.DoWork += bw_DoWork;
                        bw.RunWorkerCompleted += bw_RunWorkerCompleted;

                        object[] threadParamerter = new object[2];
                        threadParamerter[0] = toolToExecute;
                        threadParamerter[1] = progForm;

                        // Show the progress dialog and kick off the Async thread
                        progForm.Show(this);
                        bw.RunWorkerAsync(threadParamerter);
                    }
                }
            }
        }