/// <summary> /// Opens an item. /// </summary> /// <param name="payload">The payload.</param> void OpenItem(object payload) { var debugState = payload as IDebugState; if (debugState == null) { return; } if (debugState.ActivityType == ActivityType.Workflow && EnvironmentRepository != null) { var environment = EnvironmentRepository.All().FirstOrDefault(e => e.ID == debugState.EnvironmentID); if (environment == null || !environment.IsConnected) { return; } var resource = environment.ResourceRepository.FindSingle(r => r.ResourceName == debugState.DisplayName); if (resource == null) { return; } EventPublishers.Aggregator.Publish(new AddWorkSurfaceMessage(resource)); } }
protected override void OnDispose() { if (EnvironmentRepository != null) { foreach (IEnvironmentModel environment in EnvironmentRepository.All()) { environment.ResourceRepository.Dispose(); } EnvironmentRepository.Dispose(); EnvironmentRepository = null; } _eventPublisher.Unsubscribe(this); base.OnDispose(); }