Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created May 8, 2012 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinisCruz/2640284 to your computer and use it in GitHub Desktop.
Save DinisCruz/2640284 to your computer and use it in GitHub Desktop.
Visualize TeamMentor Article's Links using GraphSharp
"graph".o2Cache(null);
var graph = "graph".o2Cache<GraphSharp.Controls.GraphLayout>(
()=> {
var topPanel = panel.clear().add_Panel();
var _graph = topPanel.add_Graph();
var graphOptions = topPanel.add_GraphOptions(_graph);
graphOptions.str().info();
return _graph;
});
var tmSite = "http://localhost.:12115/";
var readerPwd= "!!tmreader";
var teamMentor = "tmSite".o2Cache<API_TeamMentor_WebServices>(()=>{
var _teamMentor = new API_TeamMentor_WebServices(tmSite);
_teamMentor.login("reader", readerPwd);
return _teamMentor;
});
var library = teamMentor.library("PHP");
var articles = library.articles();
"got articles".info();
graph.clear();
graph.defaultLayout();
graph.overlapRemovalParameters(20, 50);
foreach(var article in articles.Take(20))
{
var htmlCode = article.Content;
var htmlDocument = htmlCode.htmlDocument();
foreach(var link in htmlDocument.links())
{
graph.add_Edge(article.Title, link.value().split(":").last());
}
}
return graph.typeName();
//using SecurityInnovation.TeamMentor;
//O2File:C:\_WorkDir\O2\O2 Install\_TeamMentor\TeamMentor-UnitTests\APIs\API_TeamMentor_WebServices.cs
//O2File:HtmlAgilityPack_ExtensionMethods.cs
//O2Ref:O2_Misc_Microsoft_MPL_Libs.dll
//O2Ref:System.Web.Services.dll
//O2Tag_DontAddExtraO2Files
//using System.Xml.Linq
//using System.Linq
//using WPF=System.Windows.Controls
//using O2.API.Visualization.ExtensionMethods
//O2File:GraphSharp_ExtensionMethods.cs
//O2File:VerticesAndEdges_ExtensionMethods.cs
//O2File:WPF_ExtensionMethods.cs
//O2Ref:System.Xml.dll
//O2Ref:System.Xml.Linq.dll
//O2Ref:O2_API_Visualization.dll
//O2Ref:PresentationCore.dll
//O2Ref:PresentationFramework.dll
//O2Ref:WindowsBase.dll
//O2Ref:System.Core.dll
//O2Ref:WindowsFormsIntegration.dll
//O2Ref:GraphSharp.dll
//O2Ref:QuickGraph.dll
//O2Ref:GraphSharp.Controls.dll
//O2Ref:ICSharpCode.AvalonEdit.dll
//O2Ref:System.Xaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment