/// <summary>Hit when the open solution is closed.</summary>
        private void SolutionEvents_AfterClosing()
        {
            try
            {
                //Get the window.
                ToolWindowPane window = this.FindToolWindow(typeof(toolSpiraExplorer), 0, false);
                if (window != null)
                {
                    cntlSpiraExplorer toolWindow = (cntlSpiraExplorer)window.Content;
                    toolWindow.loadSolution(null);
                }

                //Close all open details windows.
                lock (SpiraExplorerPackage._windowDetails)
                {
                    foreach (KeyValuePair <TreeViewArtifact, int> detailWindow in SpiraExplorerPackage._windowDetails)
                    {
                        ToolWindowPane windowDetail = this.FindToolWindow(typeof(toolSpiraExplorerDetails), detailWindow.Value, false);
                        if (windowDetail != null)
                        {
                            ((IVsWindowFrame)windowDetail.Frame).Hide();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "SolutionEvents_AfterClosing()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 /// <summary>Hit when the open solution is closed.</summary>
 private void SolutionEvents_AfterClosing()
 {
     try
     {
         //Get the window.
         ToolWindowPane window = this.FindToolWindow(typeof(toolSpiraExplorer), 0, false);
         if (window != null)
         {
             cntlSpiraExplorer toolWindow = (cntlSpiraExplorer)window.Content;
             toolWindow.loadSolution(null);
         }
     }
     catch (Exception ex)
     {
         Logger.LogMessage(ex, "SolutionEvents_AfterClosing()");
         MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        /// <summary>Hit when an open solution is renamed.</summary>
        /// <param name="OldName">The old name of the solution.</param>
        private void SolutionEvents_Renamed(string OldName)
        {
            try
            {
                //Get the new name of the solution..
                if (Business.StaticFuncs.GetEnvironment.Solution.IsOpen)
                {
                    string NewName = (string)Business.StaticFuncs.GetEnvironment.Solution.Properties.Item("Name").Value;
                    if (!string.IsNullOrWhiteSpace(NewName))
                    {
                        //Modify the settings to transfer over projects.
                        if (Settings.Default.AssignedProjects.ContainsKey(OldName))
                        {
                            string strAssignedProjects = Settings.Default.AssignedProjects[OldName];
                            Settings.Default.AssignedProjects.Remove(OldName);
                            if (Settings.Default.AssignedProjects.ContainsKey(NewName))
                            {
                                Settings.Default.AssignedProjects[NewName] = strAssignedProjects;
                            }
                            else
                            {
                                Settings.Default.AssignedProjects.Add(NewName, strAssignedProjects);
                            }
                            Settings.Default.Save();
                        }

                        //Reload projects..
                        ToolWindowPane window = this.FindToolWindow(typeof(toolSpiraExplorer), 0, false);
                        if (window != null)
                        {
                            cntlSpiraExplorer toolWindow = (cntlSpiraExplorer)window.Content;
                            toolWindow.loadSolution(NewName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "SolutionEvents_Renamed()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 /// <summary>Hit when a solution is opened.</summary>
 private void SolutionEvents_Opened()
 {
     try
     {
         if (Business.StaticFuncs.GetEnvironment.Solution.IsOpen)
         {
             //Get the window.
             ToolWindowPane window = this.FindToolWindow(typeof(toolSpiraExplorer), 0, false);
             if (window != null)
             {
                 cntlSpiraExplorer toolWindow = (cntlSpiraExplorer)window.Content;
                 toolWindow.loadSolution((string)Business.StaticFuncs.GetEnvironment.Solution.Properties.Item("Name").Value);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.LogMessage(ex, "SolutionEvents_Opened()");
         MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }