private void SetupProjectTemplates() { var programClassTemplate = new NetAstFileTemplate("Program", "Program", null, CodeEditorExtension.Instance, CodeDomUnitFactory.CreateEntryPointModuleUnit("%folder%", "Program")); var method = programClassTemplate.CompileUnit.Namespaces[1].Types[0].Members[0] as CodeMemberMethod; method.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(STAThreadAttribute)))); method.Statements.AddRange(new CodeStatement[] { new CodeExpressionStatement( new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodeTypeReferenceExpression(typeof(Application)), "EnableVisualStyles"))), new CodeExpressionStatement( new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodeTypeReferenceExpression(typeof(Application)), "SetCompatibleTextRenderingDefault"), new CodePrimitiveExpression(false))), new CodeExpressionStatement( new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodeTypeReferenceExpression(typeof(Application)), "Run"), new CodeObjectCreateExpression("Form1"))), }); var formClassTemplate = new NetAstFileTemplate( "Form1", "Form1", null, CodeEditorExtension.Instance, CodeDomUnitFactory.CreateFormClass("%folder%", "Form1")); var formDesignerClassTemplate = new NetAstFileTemplate( "Form1.Designer", "Form1", null, this, CodeDomUnitFactory.CreateFormDesignerClass("%folder%", "Form1")); var formTemplate = new NetFormTemplate( "Form1", Properties.Resources.window_new, this, formDesignerClassTemplate, formClassTemplate); var csProject = new NetProjectTemplate( "Windows Forms Application", Properties.Resources.window_list, LanguageDescriptor.GetLanguage <CSharpLanguage>(), SubSystem.Windows, programClassTemplate, formTemplate); csProject.References.AddRange(new string[] { "System.Drawing.dll", "System.Windows.Forms.dll" }); LanguageDescriptor.GetLanguage <CSharpLanguage>().Templates.Add(csProject); var vbProject = new NetProjectTemplate( "Windows Forms Application", Properties.Resources.window_list, LanguageDescriptor.GetLanguage <VisualBasicLanguage>(), SubSystem.Windows, programClassTemplate, formTemplate); vbProject.References.AddRange(new string[] { "System.Drawing.dll", "System.Windows.Forms.dll" }); LanguageDescriptor.GetLanguage <VisualBasicLanguage>().Templates.Add(vbProject); }
private void SetupProjectTemplates() { var programTemplate = new NetAstFileTemplate("Program", "Program", null, this, CodeDomUnitFactory.CreateEntryPointModuleUnit("%folder%", "Program")); LanguageDescriptor.GetLanguage <CSharpLanguage>().Templates.Add(new NetProjectTemplate( "Console Application", Properties.Resources.console, LanguageDescriptor.GetLanguage <CSharpLanguage>(), SubSystem.Console, programTemplate)); LanguageDescriptor.GetLanguage <VisualBasicLanguage>().Templates.Add(new NetProjectTemplate( "Console Application", Properties.Resources.console, LanguageDescriptor.GetLanguage <VisualBasicLanguage>(), SubSystem.Console, programTemplate)); programTemplate = new NetAstFileTemplate("Class1", "Class1", null, this, CodeDomUnitFactory.CreateClassUnit("%folder%", "Class1")); LanguageDescriptor.GetLanguage <CSharpLanguage>().Templates.Add(new NetProjectTemplate( "Class Library", Properties.Resources.dll, LanguageDescriptor.GetLanguage <CSharpLanguage>(), SubSystem.Library, programTemplate)); LanguageDescriptor.GetLanguage <VisualBasicLanguage>().Templates.Add(new NetProjectTemplate( "Class Library", Properties.Resources.dll, LanguageDescriptor.GetLanguage <VisualBasicLanguage>(), SubSystem.Library, programTemplate)); }