/// <summary>Hit when the user decides to open the details of an item.</summary>
        /// <param name="sender">String containing the tag to open.</param>
        /// <param name="e">EventArgs</param>
        void wpfCtrl_OpenDetails(object sender, EventArgs e)
        {
            try
            {
                this.logMessage("Connect::wpfCtrl_OpenDetails(" + ((sender != null) ? ((sender.GetType() == typeof(string)) ? sender : "object") : "null") + ", " + ((e == null) ? "null" : "object") + ")", System.Diagnostics.EventLogEntryType.Information);

                //Open the Details of an item.
                SpiraProject itemProj = SpiraProject.GenerateFromString(((string)sender).Split(SpiraProject.CHAR_RECORD)[0]);
                string       itemCode = ((string)sender).Split(SpiraProject.CHAR_RECORD)[1].ToUpperInvariant();
                string       itemType = itemCode.Split(':')[0];
                int          itemNum  = int.Parse(itemCode.Split(':')[1]);

                if (this.win_Details.ContainsKey(itemCode))
                {
                    this.logMessage("Connect::wpfCtrl_OpenDetails  Activate Detail Window", System.Diagnostics.EventLogEntryType.Information);
                    //Activate existing window.
                    this.win_Details[itemCode].Visible = true;
                    this.win_Details[itemCode].Activate();
                }
                else
                {
                    this.logMessage("Connect::wpfCtrl_OpenDetails  Create Detail Window", System.Diagnostics.EventLogEntryType.Information);
                    //Create new window.
                    string tabTitle = "";
                    string winClass = "";
                    if (itemType == "TK")
                    {
                        winClass = "Inflectra.SpiraTest.IDEIntegration.VisualStudio.WinForms.Forms.ucDetailsTask";
                        tabTitle = "Task #" + itemNum.ToString();
                    }
                    else if (itemType == "IN")
                    {
                        winClass = "Inflectra.SpiraTest.IDEIntegration.VisualStudio.WinForms.Forms.ucDetailsIncident";
                        tabTitle = "Incident #" + itemNum.ToString();
                    }
                    else if (itemType == "RQ")
                    {
                        winClass = "Inflectra.SpiraTest.IDEIntegration.VisualStudio.WinForms.Forms.ucDetailsRequirement";
                        tabTitle = "Requirement #" + itemNum.ToString();
                    }

                    //Create the window here.
                    object   refObj  = new object();
                    Windows2 windows = ((Windows2)this._applicationObject.Windows);
                    string   asm     = Assembly.GetExecutingAssembly().Location;

                    string newGuid = "{" + Guid.NewGuid().ToString() + "}";

                    try
                    {
                        Window2 win_Detail = (Window2)windows.CreateToolWindow2(this._addInInstance,
                                                                                asm,
                                                                                winClass,
                                                                                this._resources.GetString("strProjectTreeName"),
                                                                                newGuid,
                                                                                ref refObj);

                        try
                        {
                            win_Detail.SetTabPicture(((System.Drawing.Bitmap) this._resources.GetObject("2")).GetHbitmap().ToInt32());
                        }
                        catch (Exception ex)
                        {
                            try
                            {
                                win_Detail.SetTabPicture(((System.Drawing.Bitmap) this._resources.GetObject("2")).GetHbitmap());
                            }
                            catch (Exception ex2)
                            {
                                Connect.logEventMessage("Connect:wpfCtrl_OpenDetails  Could not load icon image.", ex2, System.Diagnostics.EventLogEntryType.Error);
                                Connect.logEventMessage("Connect:wpfCtrl_OpenDetails  Could not load icon image. Inner Exception", ex, System.Diagnostics.EventLogEntryType.Error);
                            }
                        }
                        win_Detail.IsFloating = false;
                        try
                        {
                            win_Detail.WindowState = vsWindowState.vsWindowStateMaximize;
                        }
                        catch { }
                        win_Detail.AutoHides = false;
                        win_Detail.Linkable  = false;
                        win_Detail.Visible   = true;
                        win_Detail.Caption   = tabTitle;

                        if (itemType == "TK")
                        {
                            ucDetailsTask  Ctrl    = (ucDetailsTask)win_Detail.Object;
                            wpfDetailsTask WpfCtrl = (wpfDetailsTask)Ctrl.elementHost1.Child;

                            WpfCtrl.setDetailWindow = win_Detail;
                            WpfCtrl.LoadTask(itemProj, itemCode);
                        }
                        else if (itemType == "IN")
                        {
                            ucDetailsIncident  Ctrl    = (ucDetailsIncident)win_Detail.Object;
                            wpfDetailsIncident WpfCtrl = (wpfDetailsIncident)Ctrl.elementHost1.Child;

                            WpfCtrl.setDetailWindow = win_Detail;
                            WpfCtrl.loadItem(itemProj, itemCode);
                        }
                        else if (itemType == "RQ")
                        {
                            ucDetailsRequirement  Ctrl    = (ucDetailsRequirement)win_Detail.Object;
                            wpfDetailsRequirement WpfCtrl = (wpfDetailsRequirement)Ctrl.elementHost1.Child;

                            WpfCtrl.setDetailWindow = win_Detail;
                            WpfCtrl.LoadRequirement(itemProj, itemCode);
                        }

                        this.win_Details.Add(itemCode, win_Detail);
                    }
                    catch (Exception ex)
                    {
                        Connect.logEventMessage("Connect::wpfCtrl_OpenDetails  Create Detail Window", ex, System.Diagnostics.EventLogEntryType.Error);
                    }
                }
                this.logMessage("Connect::wpfCtrl_OpenDetails  Exit", System.Diagnostics.EventLogEntryType.Information);
            }
            catch (Exception ex)
            {
                Connect.logEventMessage("Connect::wpfCtrl_OpenDetails", ex, System.Diagnostics.EventLogEntryType.Error);
            }
        }