Exemplo n.º 1
0
        internal static void RemoveService(DataService dataService)
        {
            try
            {
                Action action = new Action(() =>
                        {
                            _serviceCollection.Remove(dataService);
                            innerServiceCollection = _serviceCollection.ToList();
                        });

                //if (_dispatcher == null)
                action.Invoke();
                //else
                //    _dispatcher.Invoke(action);
            }
            catch (Exception ex)
            {
                _logService.Error(string.Format("ExistCatch:error:<-{0}->:{1} \r\n error detail:{2}", "RemoveService", ex.Message, ex.ToString()));
            }
        }
Exemplo n.º 2
0
        internal static void AddService(DataService service)
        {
            try
            {
                Action action = new Action(() =>
                {
                    foreach (DataService ds in _serviceCollection.Where(i => i.IsInterrupted).ToArray())
                        _serviceCollection.Remove(ds);

                    _serviceCollection.Add(service);
                    innerServiceCollection = _serviceCollection.ToList();
                });

                action.Invoke();

                //if (_dispatcher == null)
                //    action.Invoke();
                //else
                //    _dispatcher.Invoke(action);
            }
            catch (Exception ex)
            {
                _logService.Error(string.Format("ExistCatch:error:<-{0}->:{1} \r\nError detail:{2}", "AddService", ex.Message, ex.ToString()));
            }
        }