RIM.VSNDK_Package.VSNDK_PackagePackage.startDebugCommandEvents_BeforeExecute C# (CSharp) Method

startDebugCommandEvents_BeforeExecute() private method

New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app.
private startDebugCommandEvents_BeforeExecute ( string Guid, int ID, object CustomIn, object CustomOut, bool &CancelDefault ) : void
Guid string Command GUID.
ID int Command ID.
CustomIn object Custom IN Object.
CustomOut object Custom OUT Object.
CancelDefault bool Cancel the default execution of the command.
return void
        private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
        {
            bool bbPlatform = false;
            if (_dte.Solution.SolutionBuild.ActiveConfiguration != null)
            {
                isDebugConfiguration = checkDebugConfiguration();

                SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts;
                foreach (SolutionContext sc in scCollection)
                {
                    if (sc.PlatformName == "BlackBerry" || sc.PlatformName == "BlackBerrySimulator")
                    {
                        bbPlatform = true;
                        if (sc.PlatformName == "BlackBerrySimulator")
                            _isSimulator = true;
                        else
                            _isSimulator = false;
                    }
                }
            }

            Debug.WriteLine("Before Start Debug");

            if (VSNDK.Package.ControlDebugEngine.isDebugEngineRunning || !bbPlatform)
            {
                // Disable the override of F5 (this allows the debugged process to continue execution)
                CancelDefault = false;
            }
            else
            {
                // Create a reference to the Output window.
                // Create a tool window reference for the Output window
                // and window pane.
                OutputWindow ow = ((DTE2)_dte).ToolWindows.OutputWindow;

                // Select the Build pane in the Output window.
                _owP = ow.OutputWindowPanes.Item("Build");
                _owP.Activate();

                if (isDebugConfiguration)
                {
                    UpdateManagerData upData = new UpdateManagerData();

                    if (!upData.validateDeviceVersion(_isSimulator))
                    {
                        CancelDefault = true;
                    }
                    else
                    {
                        BuildBar();
                        CancelDefault = true;
                    }
                }
                else
                {
                    BuildBar();
                    CancelDefault = true;
                }
            }
        }