private void BootStrap(SourceTree sourceTree)
        {
            DialogResult dialogResult = MessageBox.Show(String.Format("Source folder {0} does not exist.\nDo you want to bootstrap?", sourceTree.SourceFolder), "Source Folder Not Found", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                sourceTree.Bootstrap();
            }
        }
        private void LocationsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            SourceTree sourceTree = GetSourceTree();

            if (sourceTree == null)
            {
                return;
            }

            IList <string> ppDirs = Utilities.Instance.FindPowerPlatformFolders(sourceTree.Path, sourceTree.EnvBatFileName);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SourceTree sourceTree = GetSourceTree();

            if (sourceTree == null)
            {
                return;
            }

            IList <string> ppDirs = Utilities.Instance.FindPowerPlatformFolders(sourceTree.Path, sourceTree.EnvBatFileName);
        }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            SourceTree sourceTree = GetSourceTree();

            if (sourceTree == null)
            {
                return;
            }

            Command cmd = Utilities.Instance.FindCommandByName(Configuration.Commands, "update");

            ExecuteCommand(cmd, sourceTree.SourceFolder);
        }
        private void ExecuteCommand(Command cmd, string startFolder)
        {
            if (cmd == null)
            {
                return;
            }

            SourceTree sourceTree = GetSourceTree();

            if (sourceTree == null)
            {
                return;
            }

            if (!sourceTree.Bootstrapped)
            {
                BootStrap(sourceTree);
                // even though we bootstrap we need to return without executing the command, user has to pick it again
                return;
            }

            string cmdString = sourceTree.GetFullCommandString(cmd.Name);

            //if(!ConfirmCommand (sourceTree, cmd, cmdString))
            //    return;

            //if(!String.IsNullOrEmpty (cmd.Cmd))
            //    Clipboard.SetText (cmd.Cmd);

            //KillCurrentProcessButton.Enabled = true;
            if (startFolder == null)
            {
                startFolder = sourceTree.RootFolder;
            }

            if (cmd.RequiresShell)
            {
                sourceTree.RunCommand(cmdString, startFolder);
            }
            else
            {
                Utilities.Instance.RunProcess(cmd.Cmd, cmd.Args);
            }

            //if(cmd.Refresh)
            //    {
            //    //MessageBox.Show ("Select Ok to refresh", "refresh", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //    System.Threading.Thread.Sleep (4500);
            //    RefreshConfiguration ();
            //    }
        }
        //private bool ConfirmCommand(SourceTree sourceTree, Command cmd, string cmdString)
        //    {
        //    if(!Configuration.ConfirmCommand || !cmd.ConfirmCommand)
        //        return true;

        //    System.Windows.Forms.DialogResult dialogResult =
        //        System.Windows.Forms.MessageBox.Show (
        //            String.Format ("{1} {2}{0}{3} {4}{0}{5} {6}{0}{7} {8}{0}{0}{9} {0}",
        //                            System.Environment.NewLine,
        //                            "Configuration:", Configuration.Description,
        //                            "Stream:", sourceTree.Stream,
        //                            "Application:", sourceTree.Application,
        //                            "Command:", cmdString,
        //                            "Proceed?"),
        //                "Command Confirmation",
        //                System.Windows.Forms.MessageBoxButtons.YesNo
        //        );
        //    if(dialogResult == System.Windows.Forms.DialogResult.Yes)
        //        return true;

        //    return false;

        //    }


        private void BootstrapButton_Click(object sender, EventArgs e)
        {
            SourceTree sourceTree = GetSourceTree();

            if (sourceTree == null)
            {
                return;
            }

            if (!sourceTree.Bootstrapped)
            {
                sourceTree.Bootstrap();
            }
        }