public void RunCreator(DTE dte)
{
if (DllFileList.Count < 1)
{
Console.WriteLine("Could not find DLLs!");
return;
}
Console.WriteLine("Creating context for templates.");
string tempProjPath = Path.Combine(Path.GetTempPath(), "tempProj");
if (Directory.Exists(tempProjPath))
{
Directory.Delete(tempProjPath, true);
}
Console.WriteLine("1");
string fileName = ((Solution2)dte.Solution).GetProjectTemplate("WindowsApplication.zip", "CSharp");
Console.WriteLine("2");
switch (fileName)
{
case null:
case "":
fileName = ((Solution2)dte.Solution).GetProjectTemplate("WindowsApplication.zip", "VisualBasic");
break;
}
Console.WriteLine("3");
if ((fileName == null) || (fileName == string.Empty))
{
fileName = ((Solution2)dte.Solution).GetProjectTemplate("WindowsApplication.zip", "csharp");
}
Console.WriteLine("Adding solution template.");
Application.DoEvents();
System.Threading.Thread.Sleep(10000);
dte.Solution.AddFromTemplate(fileName, tempProjPath, "temp.cproj", false);
dte.Solution.Close(false);
Application.DoEvents();
dte.ExecuteCommand("View.PropertiesWindow", "");
Window window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindToolbox);
Application.DoEvents();
window.Activate();
ToolBox box = window.Object as ToolBox;
ToolBoxTabs tabs = box.ToolBoxTabs;
ToolBoxTab tab;
try
{
tab = FindOrCreateTab(tabs, TABLABLE, false);
if (_option == "install")
{
if (tab != null)
{
tab.Delete();
Console.WriteLine("Deleting tab: [" + TABLABLE + "]");
}
Console.WriteLine("Locating tab.");
tab = FindOrCreateTab(tabs, TABLABLE, true);
dte.ExecuteCommand("View.PropertiesWindow", "");
tab.Activate();
Console.WriteLine("Acquiring Components.");
this.ComponentDataList = this.GetAllComponentsData();
if (ComponentDataList.Count < 1) return;
Console.WriteLine("\nRegistering...");
foreach (ComponentData componentData in this.ComponentDataList)
{
RegComponent(tab, componentData);
System.Threading.Thread.Sleep(500);
}
}
else
{
if (tab != null)
{
tab.Delete();
Console.WriteLine("Deleting tab: [" + TABLABLE + "]");
}
}
Console.WriteLine("Done...");
}
catch
{
throw;
}
}