private void ReLoadIssueMenu(ToolStripMenuItem menu, DTO.WorkDatas.Issue issue)
        {
            this.Utils.Safe(this.MainMenu, () =>
            {
                menu.Text  = $"{issue.Key} :: {issue.Summary}";
                menu.Image = (Recursos.Get <Icon>($"Priority{issue.Priority}") ?? Resources.refresh).ToBitmap();

                // Ver
                if (!menu.SubMenus(p => p.Text == "Ver").Any())
                {
                    menu.DropDownItems.Add(new ToolStripMenuItem("Ver", Resources.scroll_view.ToBitmap(), (sender, e) => this.Utils.Action.OpenIssue(sender.GetTag <DTO.WorkDatas.Issue>())).Do(m => m.Tag = issue));
                }

                // Cargar Horas
                if (!menu.SubMenus(p => p.Text == "Registrar Trabajo").Any())
                {
                    menu.DropDownItems.Add(new ToolStripMenuItem("Registrar Trabajo", Resources.stopwatch.ToBitmap(), (sender, e) =>
                                                                 this.Utils.Safe(this.Utils.MainForm, () => { new Forms.Tools.RegisterWork(sender.GetTag <string>()).ShowDialog(); })).Do(m => m.Tag = issue.Key)
                                           );
                }

                // Abrir en Explorador
                if (!menu.SubMenus(p => p.Text == "Abrir en Explorador").Any())
                {
                    menu.DropDownItems.Add(this.Utils.Menu.CreateOpenUrlMenu("Abrir en Explorador", BLL.Factory.Jira.Config.GetIssueUrl(issue.Key)));
                }

                // Adjuntos (index:1)
                var mAdjuntos = menu.SubMenus(p => p.Text == "Adjuntos").SingleOrDefault();
                if (mAdjuntos == null)
                {
                    menu.DropDownItems.Add(mAdjuntos = new ToolStripMenuItem("Adjuntos", Resources.books.ToBitmap()));
                }
                mAdjuntos.Visible = issue.Adjuntos.Count > 0;

                if (issue.Adjuntos.Count > 0)
                {
                    mAdjuntos.RemoveMenus(p => !issue.Adjuntos.Select(a => a.Filename).Contains(((DTO.WorkDatas.Attachment)p.Tag).Filename));   // elimino los menús de archivos que ya no están mas

                    foreach (var adj in issue.Adjuntos.Where(p => !mAdjuntos.SubMenus().Select(a => ((DTO.WorkDatas.Attachment)a.Tag).Filename).Contains(p.Filename)))
                    {
                        mAdjuntos.DropDownItems.Add(
                            this.Utils.Menu.CreateOpenUrlMenu(adj.Filename, adj.Content, Recursos.GetImageForFile(adj.Filename, adj.MimeType)).Do(m => m.Tag = adj)
                            );
                    }
                }

                // Transiciones (index:2)
                var mTransicion = menu.SubMenus(p => p.Text == "Mover").SingleOrDefault();
                if (mTransicion == null)
                {
                    menu.DropDownItems.Add(mTransicion = new ToolStripMenuItem("Mover", Resources.navigate_right.ToBitmap()));
                }
                mTransicion.Visible = (issue.Transitions?.Count ?? 0) > 0;

                if ((issue.Transitions?.Count ?? 0) > 0)
                {
                    foreach (var m in mTransicion.SubMenus())   // oculto todos los submenús
                    {
                        m.Visible = false;
                    }

                    foreach (var tran in issue.Transitions)
                    {
                        var mExists = mTransicion.SubMenus(m => ((DTO.WorkDatas.Transition)m.GetTag <dynamic>().tran).Id == tran.Id).SingleOrDefault();

                        if (mExists != null)
                        {
                            mExists.Visible = true;
                        }
                        else
                        {
                            mTransicion.DropDownItems.Add(this.Utils.Menu.CreateTransitionMenu(issue, tran));
                        }
                    }
                }
            });
        }
        private void ReLoadInfo()
        {
            this.Text          = $"Issue {this.JiraObj.key} - {this.JiraObj.fields.summary}";
            this.lSummary.Text = this.JiraObj.fields.summary;


            // Adjuntos
            mAdjuntos.Enabled = this.JiraObj.fields.attachment.Count > 0;
            mAdjuntos.RemoveMenus();
            foreach (var adj in this.JiraObj.fields.attachment.OrderByDescending(p => p.created))
            {
                mAdjuntos.DropDownItems.Add(
                    this.Utils.Menu.CreateOpenUrlMenu($"{adj.created:dd/MM/yyyy HH:mm} {adj.filename}", adj.content, Recursos.GetImageForFile(adj.filename, adj.mimeType))
                    );
            }

            // Issues relacionados
            mIssues.Enabled = this.JiraObj.fields.issuelinks.Count > 0;
            mIssues.RemoveMenus();
            foreach (var obj in this.JiraObj.fields.issuelinks)
            {
                var esWorkIssue = (obj.type.id == BLL.Factory.Config.Global.Work.Clonning.IdLinkType &&
                                   obj.inwardIssue?.fields?.issuetype?.id == BLL.Factory.Config.Global.Work.Clonning.IdIssueType);

                if (esWorkIssue)
                {
                    this.WorkIssue = obj.inwardIssue;
                }
                else
                {
                    var issue = obj.inwardIssue != null ? obj.inwardIssue : obj.outwardIssue;
                    var text  = $"{(obj.inwardIssue != null ? obj.type.inward : obj.type.outward)} {issue.key} - {issue.fields.summary}";

                    mIssues.DropDownItems.Add(
                        this.Utils.Menu.CreateOpenUrlMenu(text, BLL.Factory.Jira.Config.GetIssueUrl(issue.key))
                        );
                }
            }

            // Transiciones
            mTransitions.Enabled = this.JiraTransitions.Count() > 0;
            mTransitions.RemoveMenus();
            foreach (var obj in this.JiraTransitions)
            {
                mTransitions.DropDownItems.Add(
                    this.Utils.Menu.CreateTransitionMenu(new DTO.WorkDatas.Issue(this.JiraObj), new DTO.WorkDatas.Transition(obj))
                    );
            }


            // HTML's
            var backcolor = $"#{this.BackColor.R.ToString("X")}{this.BackColor.G.ToString("X")}{this.BackColor.B.ToString("X")}";

            string html = $@"<html>
                                <head>
                                    <style type=""text/css"">
                                        body {{ 
                                            background-color: {backcolor}; 
                                            font-family: -apple-system, BlinkMacSystemFont, ""Segoe UI"", Roboto, Oxygen, Ubuntu, ""Fira Sans"", ""Droid Sans"", ""Helvetica Neue"", sans-serif;
                                            font-size: 8px;
                                        }};

                                        h1 {{ font-size: 26px; }};
                                        h2 {{ font-size: 22px; }};
                                        h3 {{ font-size: 20px; }};
                                        h4 {{ font-size: 16px; }};
                                        h5 {{ font-size: 14px; }};
                                        p {{ font-size: 12px; }};

                                        {BLL.Factory.Jira.Config.GetCommentHtmlCss()}
                                    </style>
                                </head>
                                <body>{{body}}</body>
                            </html>";



            this.wDescription.DocumentText = html.Replace("{body}", BLL.Factory.Jira.Config.CommentToHtml(this.JiraObj.fields.description.content));


            var    first = true;
            string body  = "";

            foreach (var comment in this.JiraObj.fields.comment.comments)
            {
                var author          = comment.author.displayName;
                var authorAvatarUrl = comment.author.avatarUrls.s32x32;

                var header      = $@"{(!first ? "<hr>" : "")}
                                <table width=""100%"">
                                    <tr>
                                        <td style=""width:40px""><img src=""{authorAvatarUrl}"" alt=""{author}"" style=""width:32px; height:32px;""></img></td>
                                        <td style=""vertical-align: middle;"">{author}</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>{{commentHtml}}</td>
                                    </tr>
                                </table>";
                var commentHtml = BLL.Factory.Jira.Config.CommentToHtml(comment.body.content);

                body += header.Replace("{commentHtml}", commentHtml);
                first = false;
            }

            this.wComentarios.DocumentText = html.Replace("{body}", body);
            this.wComentarios.Refresh(WebBrowserRefreshOption.Completely);
        }