private void OnLocalizationChangingEvent(LocalizationChangingEventArgs args)
 {
     if (args != null)
     {
         CurrentProvider = _providers.FirstOrDefault(e => e.Language == args.LanguageInfo.Language);
     }
 }
        /// <summary>
        /// Changes the current language.
        /// </summary>
        /// <param name="language">The language.</param>
        public void ChangeCurrentLanguage(LanguageInfo language)
        {
            language.Culture.DateTimeFormat = _systemFormat;

            var localizationChangingArgs = new LocalizationChangingEventArgs(language);

            _localizationChangingEvent.Publish(localizationChangingArgs);

            if (localizationChangingArgs.WaitingFor.IsEmpty())
            {
                SetCurrentLanguage(language);
            }
            else
            {
                var waitTask = new WaitTask(Logger)
                {
                    Handlers = localizationChangingArgs.WaitingFor.ToArray(),
                    OnResult = result => { SetCurrentLanguage(language); }
                };

                _taskQueue.Enqueue(waitTask);
            }
        }