public static API_GitHub_Objects add_GitHub_Browser(this API_GitHub_Objects gitHubObjects , Control control)
	   	{
	    	var objects = gitHubObjects.ObjectsAPI;
	    	
	    	var topPanel = control;
	    	var actionPanel = topPanel.insert_Above(40,"Load repositories"); 
	    	
	
			var currentRepository = "";
			var doBinaryDownload = false;
			var saveFechedFiles = false;
			var folderToSaveSelectedFiles = "";
			Action<string, TreeNode> addTree =
				(shaTree, treeNode)=>
					{
						"on repository {0} , fetching tree for ShaTree: {1}".info(currentRepository, shaTree);
						objects.CacheProvider = new BasicCacher.BasicCacher(); 
						var treeItems = objects.Trees(currentRepository, shaTree);
						
						treeNode.add_Nodes(treeItems, 
										   (treeItem)=>treeItem.Name, 
										   (treeItem)=> (treeItem.Type == "tree") ? (object)treeItem   		// if this is tree return the object
										   										  : (doBinaryDownload)		// if it is a file
										   										  			? (object)treeItem.Sha	//for binary downloads we need to store the item's sha
										   										  			: shaTree,				//for ascii downloads we need to store the tree's sha
										   (treeItem)=> treeItem.Type == "tree" 
										  );
						"There are {0} nodes".info(treeNode.nodes().size());		 						  
						
						foreach(var node in treeNode.nodes())		
						{
							node.color( (node.nodes().size()==0)
												? Color.DarkBlue // it is a file
												: Color.DarkOrange // it is a tree (i.e. a folder
										  );
						}
			
						//treeNode.nodes()[0].selected();
						
					};
			
			var treeView = topPanel.add_TreeView();
			
			var sourceCodeViewer = treeView.insert_Right().add_SourceCodeViewer(); 
			var propertyGrid = treeView.insert_Below(100).add_PropertyGrid().helpVisible(false); 
			
			
			treeView.beforeExpand<GitModel.Object>(
				(treeNode, _object)=>{							
										addTree(_object.Sha, treeNode); 
									 });
			
			treeView.afterSelect<string>(
				(sha)=> {						
							treeView.backColor(Color.Azure);
							O2Thread.mtaThread(
								()=>{
										try
										{
											var fileName = treeView.selected().get_Text().urlEncode();
											objects.CacheProvider = new BasicCacher.BasicCacher(); 		
											string fileContents = "";
											if (doBinaryDownload)
											{
												var blobBinaryContent = objects.RawBinary(currentRepository, sha);								
												fileContents = blobBinaryContent.ascii();
											}
											else
											{
												var blobContent = objects.Blob(currentRepository, sha ,fileName);				
												fileContents = blobContent.Data;
											}
																			
											sourceCodeViewer.set_Text(fileContents, fileName);  								
											
											if (saveFechedFiles)  // need a better solution since this is not taking into account the current folder
											{
												var localFile = folderToSaveSelectedFiles.pathCombine(fileName);																
												"saving fetched file to: {0}".info(localFile);									
												fileContents.saveAs(localFile);
											}
										}
										catch(Exception ex)
										{
											sourceCodeViewer.set_Text(ex.Message); 
										}
										
										treeView.backColor(Color.White); 
									});					
						});
						
			treeView.afterSelect<GitModel.Object>(
				(_object)=> {					
								propertyGrid.show(_object); 
								if (_object.Type == "blob")
								{ 
									var sha = treeView.selected().get_Tag();
									"Parent sha is: {0}".info(sha);
									return ;																		
									
								}
								
							});
			
			
			var actionsPanel = topPanel.insert_Above(50);
			var repository_TextBox = actionsPanel.add_TextBox(0, "repository", "").left(100);
			var rootSha_TextBox = actionsPanel.add_TextBox(20,"root tree (Sha)", "").left(100);
			
			
			Action loadRootTree = 
				()=>{ 
						currentRepository = repository_TextBox.get_Text();
						treeView.clear();
						var rootObject = new GitModel.Object { Name = repository_TextBox.get_Text() , Sha = rootSha_TextBox.get_Text() };
						addTree(rootObject.Sha, treeView.rootNode());
					};
					
			rootSha_TextBox.onEnter((text)=>loadRootTree());
			
			Action<string,string> load = 
				(repositoryText, rootShaText)=> {
													repository_TextBox.set_Text(repositoryText);
													rootSha_TextBox.set_Text(rootShaText);
													loadRootTree();
												};
			
			actionPanel.add_Link("SecurityInnovation/YASAT", 0,0, ()=> load("SecurityInnovation/YASAT", "2d94d5d39168e38d2a10"))
					   .append_Link("SecurityInnovation/TeamMentor", ()=> load("SecurityInnovation/TeamMentor", "71419d1c49f6d9c5a6c1"))		   
					   .append_Link("DinisCruz/TeamMentor", ()=> load("DinisCruz/TeamMentor", "dc03519a8e0d766f224f")).click();
			
			actionPanel.add_CheckBox("Download selected files as Binaries Blobs", 0,500, (value)=> doBinaryDownload = value).autoSize();
			actionPanel.add_CheckBox("Save fecthed files to folder", 0,750, (value)=> saveFechedFiles = value).autoSize()
					   .append_TextBox("").align_Right(actionPanel)
					   .onTextChange((text)=> folderToSaveSelectedFiles = text)
					   .set_Text("_SavedGitFiles".tempDir(false));
	
	    return gitHubObjects;
	    }	    
        public static API_GitHub_Objects add_GitHub_Browser(this API_GitHub_Objects gitHubObjects, Control control)
        {
            var objects = gitHubObjects.ObjectsAPI;

            var topPanel    = control;
            var actionPanel = topPanel.insert_Above(40, "Load repositories");


            var currentRepository             = "";
            var doBinaryDownload              = false;
            var saveFechedFiles               = false;
            var folderToSaveSelectedFiles     = "";
            Action <string, TreeNode> addTree =
                (shaTree, treeNode) =>
            {
                "on repository {0} , fetching tree for ShaTree: {1}".info(currentRepository, shaTree);
                objects.CacheProvider = new BasicCacher.BasicCacher();
                var treeItems = objects.Trees(currentRepository, shaTree);

                treeNode.add_Nodes(treeItems,
                                   (treeItem) => treeItem.Name,
                                   (treeItem) => (treeItem.Type == "tree") ? (object)treeItem                                                                                                                  // if this is tree return the object
                                                                                                                                                                  : (doBinaryDownload)                         // if it is a file
                                                                                                                                                                                        ? (object)treeItem.Sha //for binary downloads we need to store the item's sha
                                                                                                                                                                                        : shaTree,             //for ascii downloads we need to store the tree's sha
                                   (treeItem) => treeItem.Type == "tree"
                                   );
                "There are {0} nodes".info(treeNode.nodes().size());

                foreach (var node in treeNode.nodes())
                {
                    node.color((node.nodes().size() == 0)
                                                                                                ? Color.DarkBlue   // it is a file
                                                                                                : Color.DarkOrange // it is a tree (i.e. a folder
                               );
                }

                //treeNode.nodes()[0].selected();
            };

            var treeView = topPanel.add_TreeView();

            var sourceCodeViewer = treeView.insert_Right().add_SourceCodeViewer();
            var propertyGrid     = treeView.insert_Below(100).add_PropertyGrid().helpVisible(false);


            treeView.beforeExpand <GitModel.Object>(
                (treeNode, _object) => {
                addTree(_object.Sha, treeNode);
            });

            treeView.afterSelect <string>(
                (sha) => {
                treeView.backColor(Color.Azure);
                O2Thread.mtaThread(
                    () => {
                    try
                    {
                        var fileName          = treeView.selected().get_Text().urlEncode();
                        objects.CacheProvider = new BasicCacher.BasicCacher();
                        string fileContents   = "";
                        if (doBinaryDownload)
                        {
                            var blobBinaryContent = objects.RawBinary(currentRepository, sha);
                            fileContents          = blobBinaryContent.ascii();
                        }
                        else
                        {
                            var blobContent = objects.Blob(currentRepository, sha, fileName);
                            fileContents    = blobContent.Data;
                        }

                        sourceCodeViewer.set_Text(fileContents, fileName);

                        if (saveFechedFiles)                                                                  // need a better solution since this is not taking into account the current folder
                        {
                            var localFile = folderToSaveSelectedFiles.pathCombine(fileName);
                            "saving fetched file to: {0}".info(localFile);
                            fileContents.saveAs(localFile);
                        }
                    }
                    catch (Exception ex)
                    {
                        sourceCodeViewer.set_Text(ex.Message);
                    }

                    treeView.backColor(Color.White);
                });
            });

            treeView.afterSelect <GitModel.Object>(
                (_object) => {
                propertyGrid.show(_object);
                if (_object.Type == "blob")
                {
                    var sha = treeView.selected().get_Tag();
                    "Parent sha is: {0}".info(sha);
                    return;
                }
            });


            var actionsPanel       = topPanel.insert_Above(50);
            var repository_TextBox = actionsPanel.add_TextBox(0, "repository", "").left(100);
            var rootSha_TextBox    = actionsPanel.add_TextBox(20, "root tree (Sha)", "").left(100);


            Action loadRootTree =
                () => {
                currentRepository = repository_TextBox.get_Text();
                treeView.clear();
                var rootObject = new GitModel.Object {
                    Name = repository_TextBox.get_Text(), Sha = rootSha_TextBox.get_Text()
                };
                addTree(rootObject.Sha, treeView.rootNode());
            };

            rootSha_TextBox.onEnter((text) => loadRootTree());

            Action <string, string> load =
                (repositoryText, rootShaText) => {
                repository_TextBox.set_Text(repositoryText);
                rootSha_TextBox.set_Text(rootShaText);
                loadRootTree();
            };

            actionPanel.add_Link("SecurityInnovation/YASAT", 0, 0, () => load("SecurityInnovation/YASAT", "2d94d5d39168e38d2a10"))
            .append_Link("SecurityInnovation/TeamMentor", () => load("SecurityInnovation/TeamMentor", "71419d1c49f6d9c5a6c1"))
            .append_Link("DinisCruz/TeamMentor", () => load("DinisCruz/TeamMentor", "dc03519a8e0d766f224f")).click();

            actionPanel.add_CheckBox("Download selected files as Binaries Blobs", 0, 500, (value) => doBinaryDownload = value).autoSize();
            actionPanel.add_CheckBox("Save fecthed files to folder", 0, 750, (value) => saveFechedFiles = value).autoSize()
            .append_TextBox("").align_Right(actionPanel)
            .onTextChange((text) => folderToSaveSelectedFiles = text)
            .set_Text("_SavedGitFiles".tempDir(false));

            return(gitHubObjects);
        }