예제 #1
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);
                    }
                }
            }
        }
예제 #2
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);
                        }
                    }
                }
            }
        }