// TODO: Bug how do get this thing to only show in the main form and not create phantom windows
        ////public bool GetVisible(Office.IRibbonControl control)
        ////{
        ////    // only show the tab in the mai Outlook Explorer view
        ////    return control.Context is Outlook.Explorer;
        ////}

        public string GetCustomUI(string ribbonID)
        {
            StaticHelper.LogMessage(MessageType.Info, "Getting Custom UI");
            try
            {
                if (!string.IsNullOrEmpty(this.cachedRibbon))
                {
                    return(this.cachedRibbon);
                }

                StaticHelper.LogMessage(MessageType.Info, "Checking for Updates");
                StaticHelper.CheckForUpdates();

                // Get the installation path
                DirectoryInfo installationPath = StaticHelper.GetInstallationPath();

                // Get the Outlook2010.xml file
                FileInfo f = new FileInfo(Path.Combine(installationPath.FullName, @"Templates\Outlook2010.xml"));
                if (!f.Exists)
                {
                    string message = string.Format(CultureInfo.InvariantCulture, "File not found: {0}", f.FullName);
                    StaticHelper.LogMessage(MessageType.Error, message);
                    throw new ArgumentException(message);
                }

                string ribbonXml;
                using (TextReader tr = new StreamReader(f.FullName))
                {
                    ribbonXml = tr.ReadToEnd();
                }

                // Iterate over Add-ins found
                DirectoryInfo   buttonRoot = new DirectoryInfo(Path.Combine(installationPath.FullName, "Buttons"));
                DirectoryInfo[] buttons    = buttonRoot.GetDirectories();
                StringBuilder   buttonXml  = new StringBuilder();
                foreach (FileInfo file in buttons.Select(button => new FileInfo(Path.Combine(button.FullName, "button.xml"))))
                {
                    if (!file.Exists)
                    {
                        StaticHelper.LogMessage(MessageType.Error, string.Format(CultureInfo.InvariantCulture, "File not found: {0}", file.FullName));
                        continue;
                    }

                    using (TextReader tr = new StreamReader(file.FullName))
                    {
                        buttonXml.Append(tr.ReadToEnd());
                    }
                }

                // Inject the Add-ins using regular expression
                Regex regEx = new Regex("DLBUTTONPLACHOLDER_DONOTREMOVE");
                this.cachedRibbon = regEx.Replace(ribbonXml, buttonXml.ToString());
                StaticHelper.LogMessage(MessageType.Info, "Ribbon = " + this.cachedRibbon);

                return(this.cachedRibbon);
            }
            catch (System.Exception ex)
            {
                StaticHelper.LogMessage(MessageType.Error, ex.ToString());
                throw;
            }
        }