Example #1
0
        /// <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
            }
        }
Example #2
0
        public static IEnumerable <MainButtonViewModel> CreateButtonsViewModel(
            MobileConfigurationDTO mobileConfiguration,
            Action <string> showCategoryAction)
        {
            var mainImage     = ImageUtil.GetImageSouce(mobileConfiguration.ButtonConfiguration.Image);
            var selectedImage = ImageUtil.GetImageSouce(mobileConfiguration.ButtonConfiguration.SelectedImage);

            return(mobileConfiguration.Buttons.Select(b => CreateButtonViewModel(b, mobileConfiguration.ButtonConfiguration, mainImage, selectedImage, showCategoryAction)));
        }
 public ControlBarViewModel(
     IDialogService dialogService,
     ISettingsDataService settingsDataService,
     IMobileAppConfigDataService mobileAppConfigDataService,
     MobileConfigurationDTO currentMobileConfiguration,
     IUserSessionService userSessionService,
     IContactsService contactsService,
     IPresentationDataService presentationDataService,
     ISyncLogService syncLogService
     ) : base(settingsDataService)
 {
     _presentationDataService    = presentationDataService;
     _userSessionService         = userSessionService;
     _dialogService              = dialogService;
     _mobileAppConfigDataService = mobileAppConfigDataService;
     _currentMobileConfiguration = currentMobileConfiguration;
     _contactsService            = contactsService;
     _syncLogService             = syncLogService;
     Initialize();
 }