示例#1
0
            public string BuildMenu(IRibbonControl control)
            {
                ribbon.Invalidate();

                var str = "<menu xmlns='http://schemas.microsoft.com/office/2006/01/customui'>";

                if (control.Id == "id-root")
                {
                    foreach (var repository in repositories)
                    {
                        str += "<dynamicMenu id='" + repository.Id + "' label='" + repository.Name + "' imageMso='Folder' getContent='BuildMenu' />\n";
                    }
                    if (repositories.Count() > 0)
                    {
                        str += "<menuSeparator id='separator' />";
                    }
                    str += "<button id='id-refresh' label='Refresh' imageMso='Repeat' onAction='Refresh_Click' />\n";
                }
                else
                {
                    var repositoryAndFolder = repositories.GetRepositoryFromId(control.Id);
                    var repository          = repositoryAndFolder.Item1;
                    var path = repositoryAndFolder.Item2;

                    var folders = repository.GetFolders(path).OrderBy(x => x);
                    foreach (var f in folders)
                    {
                        var name = Path.GetFileName(f);
                        var id   = repository.Folders[path + (path != "" ? "/" : "") + f];
                        str += "<dynamicMenu id='" + id + "' label='" + name + "' imageMso='Folder' getContent='BuildMenu' />\n";
                    }

                    foreach (var workbook in repository.GetWorkbooks(path).OrderBy(w => w.Path))
                    {
                        var fileName = Path.GetFileName(workbook.Path);
                        if (workbook.Branches.Count == 1)
                        {
                            str += "<button id='" + workbook.Branches.First().Id + "' label='" + fileName + "' imageMso='MicrosoftExcel' onAction='OpenWorkbook_Click' />\n";
                        }
                        else
                        {
                            str += "<dynamicMenu id='" + workbook.Id + "' label='" + fileName + "' imageMso='MicrosoftExcel' getContent='BuildWorkbookMenu' />\n";
                        }
                    }
                }
                str += "</menu>";
                return(str);
            }
示例#2
0
 public bool AllFailed()
 {
     return(failures.Count >= Repositories.Count());
 }