private async void appBarButtonRefresh_Click(object sender, RoutedEventArgs e)
        {
            var videoLibraryList = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandVideoLibraryGetMovies());

            if (videoLibraryList != "statusError" && videoLibraryList != "connectionError")
            {
                var movieList = GetInformationHelper.getVideoLibrary(videoLibraryList);

                if (movieList != null)
                {
                    // clear the database
                    deleteMovies();

                    using (var db = new MovieContext())
                    {
                        try
                        {
                            db.Movies.AddRange(movieList);
                            db.SaveChanges();
                            loadMovies();
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.Message);
                        }
                    }
                }
            }
        }
Example #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var param   = e.Parameter?.ToString();
            var service = Template10.Services.SerializationService.SerializationService.Json;

            _artist = service.Deserialize <Artist>(param);

            if (_artist != null)
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandAudioLibraryGetAlbum(Convert.ToInt32(_artist.ArtistId)));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var albumLibrary = GetInformationHelper.getAudioLibraryAlbum(response);

                        if (albumLibrary != null)
                        {
                            GridViewAlbum.ItemsSource = albumLibrary;
                        }
                    }
                }
            }
        }
Example #3
0
        // read all the information from the page navigation
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var param   = e.Parameter?.ToString();
            var service = Template10.Services.SerializationService.SerializationService.Json;

            _tvShow = service.Deserialize <TvShow>(param);

            if (_tvShow != null)
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandVideoLibraryGetSeasons(Convert.ToInt32(_tvShow.Tvshowid)));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var seasonLibrary = GetInformationHelper.getSeasonLibrary(response);

                        if (seasonLibrary != null)
                        {
                            GridViewSeason.ItemsSource = seasonLibrary;
                        }
                    }
                }
            }
        }
Example #4
0
        private async void buttonPlayMovie_Click(object sender, RoutedEventArgs e)
        {
            loadRemote();

            if (_remote != null && _movie.File != null)
            {
                var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesDownload(_movie.File));

                if (response != "statusError" && response != "connectionError")
                {
                    var file = new FileVideo();

                    var filePos = GetInformationHelper.getVideoFile(response);

                    if (string.IsNullOrWhiteSpace(filePos) != true)
                    {
                        file.File = filePos;
                        file.Host = _remote.Host;
                        file.Port = _remote.Port;
                        file.User = _remote.User;
                        file.Pass = _remote.Pass;

                        WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(PlayerPage), file);
                    }
                }
            }
        }
Example #5
0
        private async void listViewEpisode_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedEpisode = (Episode)e.ClickedItem;

            var requestDialog = new ContentDialog()
            {
                Title               = "Where do you want to play this episode?",
                Content             = Environment.NewLine + clickedEpisode.Label,
                PrimaryButtonText   = "Kodi",
                SecondaryButtonText = "mrRemote for Kodi"
            };

            var result = await requestDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPlayerOpen("episodeid", Convert.ToInt32(clickedEpisode.EpisodeId)));

                    if (response != "statusError" && response != "connectionError")
                    {
                        WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(MainPage));
                    }
                }
            }
            else if (result == ContentDialogResult.Secondary)
            {
                loadRemote();

                if (_remote != null && clickedEpisode.File != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesDownload(clickedEpisode.File));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var file = new FileVideo();

                        var filePos = GetInformationHelper.getVideoFile(response);

                        if (string.IsNullOrWhiteSpace(filePos) != true)
                        {
                            file.File = filePos;
                            file.Host = _remote.Host;
                            file.Port = _remote.Port;
                            file.User = _remote.User;
                            file.Pass = _remote.Pass;

                            WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(PlayerPage), file);
                        }
                    }
                }
            }
        }
        private async void loadFile()
        {
            if (_remote != null)
            {
                var responseVideo = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesGetSources("video"));

                var responseMusic = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesGetSources("music"));

                var responsePictures = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesGetSources("pictures"));

                if (responseVideo != "statusError" && responseVideo != "connectionError")
                {
                    var videoLibrary = GetInformationHelper.getDirectoryFile(responseVideo);

                    if (videoLibrary != null)
                    {
                        relativePanelNoVideo.Visibility = Visibility.Collapsed;
                        listViewVideo.ItemsSource       = videoLibrary;
                    }
                    else
                    {
                        relativePanelNoVideo.Visibility = Visibility.Visible;
                    }
                }

                if (responseMusic != "statusError" && responseMusic != "connectionError")
                {
                    var musicLibrary = GetInformationHelper.getDirectoryFile(responseMusic);

                    if (musicLibrary != null)
                    {
                        relativePanelNoMusic.Visibility = Visibility.Collapsed;
                        listViewMusic.ItemsSource       = musicLibrary;
                    }
                    else
                    {
                        relativePanelNoMusic.Visibility = Visibility.Visible;
                    }
                }

                if (responsePictures != "statusError" && responsePictures != "connectionError")
                {
                    var picturesLibrary = GetInformationHelper.getDirectoryFile(responsePictures);

                    if (picturesLibrary != null)
                    {
                        relativePanelNoPictures.Visibility = Visibility.Collapsed;
                        listViewPictures.ItemsSource       = picturesLibrary;
                    }
                    else
                    {
                        relativePanelNoPictures.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        // load PvrChannel
        private async void loadPvrChannel()
        {
            if (_remote != null)
            {
                var responseTv = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPvrGetChannels("alltv"));

                var responseRadio = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPvrGetChannels("allradio"));

                if (responseTv != "statusError" && responseTv != "connectionError")
                {
                    var channelLibrary = GetInformationHelper.getPvrChannel(responseTv);

                    if (channelLibrary != null)
                    {
                        relativePanelNoChannelList.Visibility = Visibility.Collapsed;
                        listViewPvrTv.ItemsSource             = channelLibrary;
                    }
                    else
                    {
                        relativePanelNoChannelList.Visibility = Visibility.Visible;
                    }
                }

                if (responseRadio != "statusError" && responseRadio != "connectionError")
                {
                    var channelLibrary = GetInformationHelper.getPvrChannel(responseRadio);

                    if (channelLibrary != null)
                    {
                        relativePanelNoRadioList.Visibility = Visibility.Collapsed;

                        listViewPvrRadio.ItemsSource = channelLibrary;
                    }
                    else
                    {
                        relativePanelNoRadioList.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        private async void listViewFile_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedFile = (FileMedia)e.ClickedItem;

            if (clickedFile.Filetype == "file")
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPlayerOpenFile(clickedFile.Directory));

                    if (response != "statusError" && response != "connectionError")
                    {
                        WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(MainPage));
                    }
                }
            }
            else if (clickedFile.Filetype == "directory")
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandFilesGetDirectory(clickedFile.Directory));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var fileLibrary = GetInformationHelper.getFile(response);

                        if (fileLibrary != null)
                        {
                            WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(FileDetailPage), fileLibrary);
                        }
                    }
                }
            }
        }
Example #9
0
        private async void GridViewSeason_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedSeason = (Season)e.ClickedItem;

            if (_tvShow != null)
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandVideoLibraryGetEpisodes(Convert.ToInt32(_tvShow.Tvshowid), Convert.ToInt32(clickedSeason.SeasonNumber)));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var episodeLibrary = GetInformationHelper.getEpisodeLibrary(response);

                        if (episodeLibrary != null)
                        {
                            listViewEpisode.ItemsSource = episodeLibrary;
                        }
                    }
                }
            }
        }
Example #10
0
        private async void GridViewAlbum_ItemClick(object sender, ItemClickEventArgs e)
        {
            _album = (Album)e.ClickedItem;

            if (_artist != null)
            {
                loadRemote();

                if (_remote != null)
                {
                    var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandAudioLibraryGetSong(Convert.ToInt32(_album.AlbumId)));

                    if (response != "statusError" && response != "connectionError")
                    {
                        var songLibrary = GetInformationHelper.getAudioLibrarySong(response);

                        if (songLibrary != null)
                        {
                            listViewSong.ItemsSource = songLibrary;
                        }
                    }
                }
            }
        }