private void btn_NewProject_Click(object sender, EventArgs e) { //TiaPortal tiaPortal = new TiaPortal(); ProjectComposition projectComposition = MyTiaPortal.Projects; DirectoryInfo targetDirectory = new DirectoryInfo(TiaProjectPath); Project project = projectComposition.Create(targetDirectory, TiaProjectName); txt_Status.Text = "New Project generated"; }
private void btnCreateProject_Click(object sender, EventArgs e) { try { TiaPortal tiaPortal = MyTiaPortal; ProjectComposition projectComposition = tiaPortal.Projects; DirectoryInfo targetDirectory = new DirectoryInfo(@"C:\TiaProjects"); Project project = projectComposition.Create(targetDirectory, txtProjectName.Text); txt_Status.Text = "Project created !"; } catch (Exception ex) { txt_Status.Text = "Error while creating project, make sure you closed all projects before creating new one" + ex.Message; } }