private void Create_Click(object sender, RoutedEventArgs e) { var name = NewProjectName.Text; if (!name.EndsWith(".ptproj")) { name = name + ".ptproj"; } var newProject = new POSHToolbeltProject(); newProject.Name = name.Substring(0, name.LastIndexOf(".ptproj")); var newFilePath = Path.Combine(_Path, name); File.WriteAllText(newFilePath, ""); var rootNode = FileBrowserService.Open(newFilePath); MainWindowHelper.SetRootTreeNode(rootNode); Close(); }