Data Model for the Update Manager Dialog
Inheritance: INotifyPropertyChanged
        /// <summary>
        /// Constructor
        /// </summary>
        public SimulatorManager()
        {
            InitializeComponent();

            umData = new UpdateManagerData();
            gridMain.DataContext = umData;
            this.Close.IsEnabled = true;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        private UpdateManager()
        {
            InitializeComponent();

            data = new UpdateManagerData();

            gridMain.DataContext = data;
            this.Close.IsEnabled = true;
            this.Simulators.IsEnabled = true;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public UpdateManagerDialog()
        {
            if (!GlobalFunctions.isOnline())
            {
                System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server.  Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                this.Close();
            }

            InitializeComponent();

            data = new UpdateManagerData();
            gridMain.DataContext = data;
        }
        /// <summary> 
        /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. 
        /// </summary>
        /// <param name="Guid"> Command GUID. </param>
        /// <param name="ID"> Command ID. </param>
        /// <param name="CustomIn"> Custom IN Object. </param>
        /// <param name="CustomOut"> Custom OUT Object. </param>
        /// <param name="CancelDefault"> Cancel the default execution of the command. </param>
        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
            {
                try
                {
                    Solution2 soln = (Solution2)_dte.Solution;
                    buildThese = new List<String>();
                    _targetDir = new List<string[]>();

                    foreach (String startupProject in (Array)soln.SolutionBuild.StartupProjects)
                    {
                        foreach (Project p1 in soln.Projects)
                        {
                            if (p1.UniqueName == startupProject)
                            {
                                buildThese.Add(p1.FullName);
                                processName = p1.Name;

                                ConfigurationManager config = p1.ConfigurationManager;
                                Configuration active = config.ActiveConfiguration;

                                foreach (Property prop in active.Properties)
                                {
                                    try
                                    {
                                        if (prop.Name == "OutputPath")
                                        {
                                            string[] path = new string[2];
                                            path[0] = p1.Name;
                                            path[1] = prop.Value.ToString();
                                            _targetDir.Add(path);
                                            break;
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }

                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }

                // 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;
                    if (_targetDir.Count > 0)
                        upData = new UpdateManagerData(_targetDir[0][1]);
                    else
                        upData = new UpdateManagerData();

                    if (!upData.validateDeviceVersion(_isSimulator))
                    {
                        CancelDefault = true;
                    }
                    else
                    {
                        BuildBar();
                        CancelDefault = true;
                    }
                }
                else
                {
                    BuildBar();
                    CancelDefault = true;
                }
            }
        }
        /// <summary> 
        /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. 
        /// </summary>
        /// <param name="Guid"> Command GUID. </param>
        /// <param name="ID"> Command ID. </param>
        /// <param name="CustomIn"> Custom IN Object. </param>
        /// <param name="CustomOut"> Custom OUT Object. </param>
        /// <param name="CancelDefault"> Cancel the default execution of the command. </param>
        private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
        {
            bool bbPlatform = false;
            if (_dte.Solution.SolutionBuild.ActiveConfiguration != null)
            {
                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();

                UpdateManagerData upData = new UpdateManagerData(this);

                if (!upData.validateDeviceVersion(_isSimulator))
                {
                    CancelDefault = true;
                }
                else
                {
                    BuildBar();
                    CancelDefault = true;
                }
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public UpdateManagerDialog(string message, string version, bool isRuntime, bool isSimulator)
        {
            if (!GlobalFunctions.isOnline())
            {
                System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server.  Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                this.Close();
            }

            InitializeComponent();

            if (version != "default")
            {
                APILevel.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                APILevel.Visibility = System.Windows.Visibility.Visible;
            }

            data = new UpdateManagerData();
            gridMain.DataContext = data;

            _version = version;
            _isRuntime = isRuntime;
            _isSimulator = isSimulator;

            lblMessage.Text = message;
        }
 public void TF_Setup()
 {
     /// Create Object
     updateManagerDataObject = new UpdateManagerData();
 }