コード例 #1
0
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            var    parameters    = NavigationParameters.CreateFromString((string)e.Parameter);
            string mediaServerId = parameters.MediaServerId;

            mediaServer = await mediaServerRepository.FindAsync(mediaServerId);

            if (mediaServer == null)
            {
                return;
            }

            if (parameters.HasParentDirectoryId)
            {
                contentDirectory = mediaServer.GetContentDirectory(parameters.ParentDirectoryId);
            }
            else
            {
                contentDirectory = mediaServer;
            }

            if (contentDirectory == null)
            {
                return;
            }

            DirectoryItems = contentDirectory.DirectoryItems
                             .ToReadOnlyReactiveCollection()
                             .AddTo(Disposable);

            if (e.NavigationMode == NavigationMode.New)
            {
                await contentDirectory.LoadDirectoryItemsAsync();
            }
        }