public ContentViewModel NewContent(object parameter) { var vm = VEFModule.UnityContainer.Resolve(typeof(AtlasViewModel), "") as AtlasViewModel; var model = VEFModule.UnityContainer.Resolve(typeof(AtlasModel), "") as AtlasModel; var view = VEFModule.UnityContainer.Resolve(typeof(AtlasView), "") as AtlasView; //Model details _loggerService.Log("Creating a new simple file using AtlasHandler", LogCategory.Info, LogPriority.Low); //Clear the undo stack // model.Document.UndoStack.ClearAll(); //Set the model and view vm.SetModel(model); vm.SetView(view); vm.Title = "Atlas"; (vm.View as UserControl).DataContext = model; vm.SetHandler(this); model.SetDirty(true); model.SetLocation("AtlasID:##:"); IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService; IAtlasService AtlasService = VEFModule.UnityContainer.Resolve(typeof(IAtlasService), "") as IAtlasService; PItem parent = null; if (pfExplorerService.SelectedItem != null) { parent = pfExplorerService.SelectedItem; } AtlasModel newAtlas = new AtlasModel(); newAtlas.Parent = parent; if (pfExplorerService.SelectedItem != null) { pfExplorerService.SelectedItem.Items.Add(newAtlas); } AtlasService.Atlass.Add(newAtlas); // AtlasService.SelectedAtlas = newAtlas; newAtlas.Open(-1); return(vm); }