public void Load(IMoBiContext context, string projectFullPath) { try { _projectConverterLogger.Clear(); _sessionManager.OpenFactoryFor(projectFullPath); using (_sessionManager.OpenSession()) { //load history first so that possible conversion command can be added to history context.HistoryManager = _historyManagerPersistor.Load(_sessionManager.CurrentSession) as IMoBiHistoryManager; var project = _projectPersistor.Load(context); if (project == null) { return; } project.FilePath = projectFullPath; project.Name = FileHelper.FileNameFromFileFullPath(projectFullPath); project.HasChanged = false; LoadJournal(context, project.JournalPath, projectFullPath); } } catch (Exception) { // Exeption occurs while opening the project! // close the file and rethrow the exception _sessionManager.CloseFactory(); context.Clear(); throw; } var notificationMessages = _projectConverterLogger.AllMessages(); if (notificationMessages.Any()) { _eventPublisher.PublishEvent(new ShowNotificationsEvent(new ReadOnlyCollection <NotificationMessage>(notificationMessages.ToList()))); } }
public void CloseProject(IMoBiContext context) { _sessionManager.CloseFactory(); context.Clear(); }