private async Task SafeExecute(Func <Task> action)
 {
     try
     {
         await action();
     }
     catch (Exception exception)
     {
         _states.ChangeToErrorState(exception.ToString());
     }
 }
        private async void PollSelectedController()
        {
            _detailStates.ChangeToLoadingState();
            try
            {
                Controller controller = await _informationProvider.ImportController(_moduleName, SelectedItem.Id);

                HandleControllerUpdate(controller);
                _detailStates.ChangeToContentState();
            }
            catch (Exception exception)
            {
                _detailStates.ChangeToErrorState(exception.ToString());
            }
        }
Beispiel #3
0
 public virtual void TryInitializeModules()
 {
     _logger.Debug(string.Format("{0} tries to initialize the view models", this));
     _states.ChangeToLoadingState();
     try
     {
         Action <string> updateInitializationMessage = m => ModuleInInitialization = m;
         InitializeScreens();
         HeadBarViewModel.BreadcrumbBarViewModel = new BreadcrumbBarViewModel(_homeScreen);
         NavigateToHome();
         _states.ChangeToContentState();
         LoginCommand.CanExecute(null);
         _logger.Debug(string.Format("{0} successfully initialized the modules.", this));
     }
     catch (Exception exception)
     {
         string errorMessage = new StringBuilder()
                               .AppendLine("An error occured while intializing the Remote UI:")
                               .Append(exception).ToString();
         _logger.ErrorFormat("{0} failed to initalize the modules: '{1}'", this, errorMessage);
         _states.ChangeToErrorState(errorMessage);
     }
 }