Пример #1
0
        public void Start(ServiceNaam serviceEnum)
        {
            var serviceHost = _servicehosts.First(x => x.ServiceNaam == serviceEnum);

            try
            {
                switch (serviceHost.Status)
                {
                case CommunicationState.Opening:
                case CommunicationState.Opened:
                    //do nothing
                    break;

                case CommunicationState.Closing:
                case CommunicationState.Closed:
                case CommunicationState.Created:
                    serviceHost.Start();
                    break;

                case CommunicationState.Faulted:
                default:
                    serviceHost.Start();
                    break;
                }
            }
            catch (Exception)
            {
                //todo: catch exception already opened (das positief, misshcien)?
                //todo: check if already in use and trykill?
                throw;
            }
        }
Пример #2
0
        public void Stop(ServiceNaam serviceEnum)
        {
            var serviceHost = _servicehosts.First(x => x.ServiceNaam == serviceEnum);

            serviceHost.Stop();
        }