/// <summary> /// Initialize Visual Browser /// Load all necessary data /// </summary> protected override async Task Initialize() { try { _currentMobileConfiguration = await _mobileConfigurationDataService.GetCurrentMobileConfiguration(); Buttons = VisualBrowserViewModelBuilder.CreateButtonsViewModel(_currentMobileConfiguration, ShowCategory).ToList(); TopCategories = VisualBrowserViewModelBuilder.CreateCategoriesViewModel(_currentMobileConfiguration.TopCategories, _navigateToMediaCommand, IsInternalModeEnable, SubCategorySelectionAction); ControlBarViewModel = new ControlBarViewModel(_dialogService, SettingsDataService, _mobileAppConfigDataService, _currentMobileConfiguration, _userSessionService, _contactsService, _presentationDataService, _syncLogService); ExpandedCategories = new ObservableCollection <CategoryViewModel>(); SearchViewModel = new SearchControlViewModel(_documentInfoDataService, _searchContentDataService, _navigationService, _navigateToMediaCommand); if (_orientation.HasValue) { RefreshButtons(_orientation.Value); GetAllCategoryContent().ForEach(c => c.HandleOrientation(_orientation.Value)); } await LoadBackgroundImage(); if (_orientation.HasValue) { BackgroundImage = ResolveBackgroundImage(_orientation.Value); } } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); // Report error here } }
protected override async Task Initialize() { try { var currentID = await SettingsDataService.GetCurrentMobileConfigurationID(); var configurations = await _mobileAppConfigDataService.GetMobileAppConfigs(); var mcSelectViewModels = VisualBrowserViewModelBuilder.CreateMobileConfigurationsSelectionViewModel(configurations, SettingsDataService, currentID, () => { MobileConfigurations.ForEach(mc => mc.IsSelected = false); }, () => { IsSelectConfigurationPopupOpen = false; }); MobileConfigurations = new ObservableCollection <MobileConfigurationsSelectionViewModel>(mcSelectViewModels); SetLogInOutStatus(); IsInternalModeEnableChecked = IsInternalModeEnable; RefreshCommands(); SetCheckInOutIcon(_presentationDataService); CheckInOutViewModel = new CheckInOutViewModel(_contactsService, _presentationDataService, SettingsDataService); } catch { //todo: log error } }