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()); } }
/// <summary> /// Loads the root controller of this module. /// </summary> public async Task LoadRootController() { _states.ChangeToLoadingState(); await SafeExecute(async() => { var controller = await _informationProvider.LoadRootController(_moduleName); var viewModel = CreateMasterDetailViewModel(controller, _controllerCommander, _moduleName); _masterTree.Clear(); _masterTree.Add(viewModel); if (SelectedItem == null) { SelectedItem = MasterTree.FirstOrDefault(); } UpdateControllerPermissions(_masterTree.FirstOrDefault()); UpdateControllerDisplayName(_masterTree.FirstOrDefault()); _states.ChangeToContentState(); }); }
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); } }