protected override async Task Initialize() { try { EditButtonDisabled = false; var navigationCommand = new NavigateToMediaCommand(_navigationService, _historyDataService); SearchViewModel = new SearchControlViewModel(_documentInfoDataService, _searchContentDataService, _navigationService, navigationCommand); var data = await _playlistsDataService.GetPlayListsData(); _allPlaylists = PlaylistViewModelBuilder.Create(data, navigationCommand, _dialogService); PopulateRemoveCommand(_allPlaylists); SetInternalMode(_allPlaylists, IsInternalModeEnable); PlayLists = _allPlaylists; EditButtonText = ReadOnlyModeStateText; var personalLibrarydata = await _playlistsDataService.GetPersonalLibrarData(); PersonalLibraryViewModel = PlaylistViewModelBuilder.Create(personalLibrarydata, navigationCommand, _dialogService); PersonalLibraryViewModel.IsInternalMode = IsInternalModeEnable; NewPlaylistViewModel = new NewPlaylistViewModel(this.PlayLists, new NavigateToMediaCommand(_navigationService, _historyDataService), _dialogService, (vm) => _allPlaylists.Remove(vm)); EditButtonDisabled = true; } catch (Exception ex) { PlatformAdapter.SendToCustomLogger(ex, LoggingLevel.Error); } }
internal static CategoryItem Create(List <BrowserData> modelData, NavigateToMediaCommand navigationCommand, bool isInternalModeEnable, Action <CategoryItem> selectCategoryAction) { Func <BrowserData, CategoryContentItem> createfunction = (md) => CreteCategoryItem(md, navigationCommand, 1, isInternalModeEnable, selectCategoryAction); var items = modelData.Select(createfunction); return(new CategoryItem(0, string.Empty, "Categories", isInternalModeEnable, selectCategoryAction, items.ToList())); }
public VisualBrowserViewModel( IMobileConfigurationDataService mobileConfigurationDataService, INavigationService navigationService, IHistoryDataService historyDataService, IMobileAppConfigDataService mobileAppConfigDataService, ISettingsDataService settingsDataService, IDialogService dialogService, IUserSessionService userSessionService, IContactsService contactsService, IPresentationDataService presentationDataService, ISearchContentDataService searchContentDataService, ISyncLogService syncLogService, IDocumentInfoDataService documentInfoDataService) : base(settingsDataService) { _documentInfoDataService = documentInfoDataService; _presentationDataService = presentationDataService; _userSessionService = userSessionService; _dialogService = dialogService; _mobileAppConfigDataService = mobileAppConfigDataService; _navigationService = navigationService; _historyDataService = historyDataService; _mobileConfigurationDataService = mobileConfigurationDataService; _navigateToMediaCommand = new NavigateToMediaCommand(_navigationService, _historyDataService); _contactsService = contactsService; _searchContentDataService = searchContentDataService; _syncLogService = syncLogService; Initialize(); }
internal static PlaylistViewModel CreateNew(string name, NavigateToMediaCommand navigationCommand, IDialogService dialogService) { var newModelData = new PlaylistData() { ID = null, Name = name, IsEditable = true, PlaylistItems = new List <MediaLink>() }; return(Create(newModelData, navigationCommand, dialogService)); }
public CategoryMediaViewModel( MediaLink media, ImageSource backgroundImage, NavigateToMediaCommand navigateToMediaCommand) { _media = media; BackgroundImage = backgroundImage; NavigateToMediaCommand = navigateToMediaCommand; }
private static IEnumerable <CategoryMediaViewModel> GetCategoryMedia( IEnumerable <DocumentInfo> documents, ImageSource backgroundImage, NavigateToMediaCommand navigateToMediaCommand) { return(documents .Select(d => new CategoryMediaViewModel(new MediaLink(d), backgroundImage, navigateToMediaCommand) ).ToList()); }
public NewPlaylistViewModel( ObservableCollection <PlaylistViewModel> collection, NavigateToMediaCommand navigationCommand, IDialogService dialogSevice, Action <PlaylistViewModel> removeMethod) { _removeMethod = removeMethod; _collection = collection; _dialogSevice = dialogSevice; _navigationCommand = navigationCommand; }
private static CategoryContentItem CreteCategoryItem(BrowserData modelData, NavigateToMediaCommand navigationCommand, int level, bool isInternalModeEnable, Action <CategoryItem> selectCategoryAction) { if (modelData.Type == BrowserDataType.Media) { return(new MediaItem(modelData.Media, navigationCommand, isInternalModeEnable)); } else { var children = modelData.Children.OrderBy(x => x.Order).ThenBy(x => x.Name).Select(md => CreteCategoryItem(md, navigationCommand, level + 1, isInternalModeEnable, selectCategoryAction)); return(new CategoryItem(level, modelData.ID, modelData.Name, isInternalModeEnable, selectCategoryAction, children.ToList())); } }
public MediaItem( MediaLink media, NavigateToMediaCommand navigationCommand, bool isInternalMode ) : base(media.ID, media.Name, isInternalMode) { _media = media; _navigationCommand = navigationCommand; IsInternalMode = isInternalMode; LoadTypeLogo(); }
public SearchControlViewModel( IDocumentInfoDataService documentInfoDataService, ISearchContentDataService searchContentDataService, INavigationService navigationService, NavigateToMediaCommand navigateToMediaCommand) { _documentInfoDataService = documentInfoDataService; _searchContentDataService = searchContentDataService; _navigationService = navigationService; _navigateToMediaCommand = navigateToMediaCommand; Initialize(); AttachMessages(); }
private static List <CategoryViewModel> GetSubCategories( IEnumerable <CategoryBrowserDTO> subCategories, NavigateToMediaCommand navigateToMediaCommand, bool isInternalMode, int level, Action <CategoryViewModel> selectAction) { return(subCategories.Select(sc => new CategoryViewModel ( level, GetCategoryContent(sc, navigateToMediaCommand, isInternalMode), GetSubCategories(sc.SubCategories, navigateToMediaCommand, isInternalMode, level + 1, selectAction), selectAction )).ToList()); }
public PlaylistViewModel( PlaylistData modelData, IEnumerable <PlaylistMediaViewModel> playlistItems, NavigateToMediaCommand navigationCommand, IDialogService dialogService ) { _navigationCommand = navigationCommand; _dialogService = dialogService; Name = modelData.Name; ModelData = modelData; var ordered = playlistItems.OrderBy(p => p.Name); AllPlayListItems = new List <PlaylistMediaViewModel>(ordered); PlayListItems = new ObservableCollection <PlaylistMediaViewModel>(ordered); }
internal static IEnumerable <CategoryViewModel> CreateCategoriesViewModel( IEnumerable <CategoryBrowserDTO> topCategories, NavigateToMediaCommand navigateToMediaCommand, bool isInternalMode, Action <CategoryViewModel> selectAction) { var currentLevel = 1; return(topCategories.Select(tc => new CategoryViewModel ( currentLevel, GetCategoryContent(tc, navigateToMediaCommand, isInternalMode), GetSubCategories(tc.SubCategories, navigateToMediaCommand, isInternalMode, currentLevel + 1, selectAction), selectAction ) ).ToList()); }
protected override async Task Initialize() { try { _navigateToMediaCommand = new NavigateToMediaCommand(_navigationService, _historyDataService); // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (SfdcConfig.AppSearchMode == SearchMode.UseSearchPage) { var allDocuments = await _documentInfoDataService.GetAllDocuments(); _mediaLinks = allDocuments.Select(d => new MediaLink(d)).ToList(); } } catch (Exception ex) { PlatformAdapter.SendToCustomLogger(ex, LoggingLevel.Error); } }
protected override async Task Initialize() { try { var navigationCommand = new NavigateToMediaCommand(_navigationService, _historyDataService); var data = await _browserDataService.GetBrowserData(); MainCategory = MenuBrowserCategoryContentViewModelBuilder.Create(data, navigationCommand, IsInternalModeEnable, SelectCategory); Categories = new ObservableCollection <CategoryItem> { MainCategory }; // Setup the Search model SearchViewModel = new SearchControlViewModel(_documentInfoDataService, _searchContentDataService, _navigationService, navigationCommand); } catch (Exception ex) { // Report error here } }
private static CategoryContentViewModel GetCategoryContent( CategoryDTO tc, NavigateToMediaCommand navigateToMediaCommand, bool isInternalMode) { return(new CategoryContentViewModel { Name = tc.Name, Header = tc.Header, Description = tc.Description, BackgroundColor = ColorUtil.FromString(tc.BackgroundColor), Opacity = Convert.ToDouble(tc.BackgroundOpacity) / 100.0, PortraitImage = ImageUtil.GetImageSouce(tc.PortraitImage), LandscapeImage = ImageUtil.GetImageSouce(tc.LandscapeImage), AllMedia = GetCategoryMedia(tc.Documents, ImageUtil.GetImageSouce(tc.MediaButtonImage), navigateToMediaCommand), NavigationAreaBackgroundColor = tc.NavigationAreaBackgroundColor, NavigationAreaImage = ImageUtil.GetImageSouce(tc.NavigationAreaImage), TextColor = tc.TextColor, HeaderTextColor = tc.HeaderTextColor, IsInternalMode = isInternalMode, Order = tc.Order }); }
internal static ObservableCollection <PlaylistViewModel> Create(List <PlaylistData> data, NavigateToMediaCommand navigationCommand, IDialogService dialogService) { return(new ObservableCollection <PlaylistViewModel>(data.Select(md => Create(md, navigationCommand, dialogService)))); }
internal static PlaylistViewModel Create(PlaylistData modelData, NavigateToMediaCommand navigationCommand, IDialogService dialogService) { return(new PlaylistViewModel(modelData, modelData.PlaylistItems.Select(md => CreateMediaViewModel(md, modelData.ID)), navigationCommand, dialogService)); }