/// <summary> /// Delete service. /// </summary> /// <param name="serviceId">The service identifier.</param> public void DeleteService(long serviceId) { if (services.ContainsKey(serviceId)) { ModuleInstance service = services[serviceId]; Module module = moduleRepository.Get(serviceId); if (module.type == (int)ModuleType.Service && module.enabled == 1) { moduleRepository.DisableService(serviceId); service.Unload(); } moduleRepository.DeleteService(serviceId); } else { moduleRepository.DeleteService(serviceId); } }