private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (YouTube.CancelPlay())
     {
         e.Cancel = true;
     }
 }
Beispiel #2
0
 protected override void OnBackKeyPress(CancelEventArgs e)
 {
     if (YouTube.CancelPlay())
     {
         // used to abort current youtube download
         e.Cancel = true;
     }
     base.OnBackKeyPress(e);
 }
Beispiel #3
0
        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (YouTube.CancelPlay())
            {
                e.Cancel = true;
            }

            if (currentContextMenu != null && currentContextMenu.IsOpen)
            {
                currentContextMenu.IsOpen = false;
                e.Cancel = true;
            }
        }
        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            if (YouTube.CancelPlay()) // used to abort current you tube download
            {
                e.Cancel = true;
            }

            //Go back to the main page
            NavigationService.Navigate(new Uri("/start.xaml", UriKind.Relative));
            //Don't allow to navigate back to the scanner with the back button
            NavigationService.RemoveBackEntry();

            base.OnBackKeyPress(e);
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            var    t          = NavigationContext.QueryString["t"];
            string apiVersion = "0"; //TODO: API Version check (API Version Changes)
            string videoId    = null;

            YouTube.CancelPlay(); // used to re-enable page

            if (NetworkInterface.GetIsNetworkAvailable())
            {
                System.Uri uri = new Uri("http://api.govision.co/v1/index.php?id=" + t);

                try
                {
                    HttpClient httpClient = new HttpClient();
                    var        response   = await httpClient.GetAsync(uri);

                    string res = await response.Content.ReadAsStringAsync();

                    videoId = res; //TODO: Change to Result variable (API Version Changes)
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Couldn't connect to Govision servers\nTry again later\n\nERROR:" + ex.Message);

                    //Go back to the main page
                    NavigationService.Navigate(new Uri("/start.xaml", UriKind.Relative));
                    //Don't allow to navigate back to the scanner with the back button
                    NavigationService.RemoveBackEntry();
                }

                if (apiVersion == "0") //TODO: API Version check (API Version Changes)
                {
                    if (videoId != null)
                    {
                        YouTubeVideo(videoId);
                    }
                }
            }
            else
            {
                MessageBox.Show("You're not connected to Internet!\nPlease check your Internet connection and tray again.");

                //Go back to the main page
                NavigationService.Navigate(new Uri("/start.xaml", UriKind.Relative));
                //Don't allow to navigate back to the scanner with the back button
                NavigationService.RemoveBackEntry();
            }
        }
        protected async override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (bLoaded)
            {
                return;
            }

            this.abibTrailer = new ApplicationBarIconButton()
            {
                Text = "trailer", IconUri = new Uri("/Images/appbar.transport.play.rest.png", UriKind.Relative)
            };
            this.abibTrailer.Click += this.btnViewTrailer_Click;

            this.abibShare = new ApplicationBarIconButton()
            {
                Text = "share", IconUri = new Uri("/Images/appbar.share03.png", UriKind.Relative)
            };
            this.abibShare.Click += this.btnShare_Click;

            if (!Config.ShowCleanBackground && SelectedFilm.MediumPosterUrl != null)
            {
                this.pMain.Background = new ImageBrush()
                {
                    ImageSource = new BitmapImage(SelectedFilm.MediumPosterUrl),
                    Opacity     = 0.2,
                    Stretch     = Stretch.UniformToFill
                };
            }

            LoadFilmDetails();

            this.ApplicationBar.Buttons.Clear();

            this.ApplicationBar.Mode = ApplicationBarMode.Minimized;

            if (!String.IsNullOrWhiteSpace(SelectedFilm.YoutubeTrailer))
            {
                this.ApplicationBar.Buttons.Add(this.abibTrailer);
            }

            this.ApplicationBar.Buttons.Add(this.abibShare);

            YouTube.CancelPlay();

            bLoaded = true;
        }
Beispiel #7
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            YouTube.CancelPlay();
            base.OnNavigatedTo(e);
            App.ViewModelLocator.MainPage.AddAlreadyAddedDate += OnAddAlreadyAddedDate;
            App.ViewModelLocator.MainPage.DatesListChanged    += DatesListOnCollectionChanged;

            App.ViewModelLocator.MainPage.GetData();

            Loaded += delegate
            {
                if (!App.StorageManager.ContainsKey(StorageKeys.NotFirstTimeOpened))
                {
                    App.StorageManager.AddOrUpdateValue(StorageKeys.NotFirstTimeOpened, true);
                    MainPagePivot.SelectedIndex = 2;
                }
            };
        }
        protected async override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SpeechSynthesisService.CancelExistingRequests();

            if (bLoaded)
            {
                return;
            }

            int iFilm = int.MinValue;

            if (this.NavigationContext.QueryString.ContainsKey("FilmID") && SelectedFilm == null)
            {
                iFilm = int.Parse(this.NavigationContext.QueryString["FilmID"]);
            }
            else
            {
                iFilm = SelectedFilm.EDI;
            }

            bool bError = false;

            try
            {
                if (App.Films == null || App.Films.Count == 0)
                {
                    LocalStorageHelper lsh = new LocalStorageHelper();
                    await lsh.DownloadFiles(false);

                    await lsh.DeserialiseObjects();
                }

                SelectedFilm = App.Films[iFilm];
            }
            catch (Exception ex)
            {
                bError = true;
            }

            if (bError)
            {
                MessageBox.Show("Error fetching film details");
            }

            this.abibTrailer = new ApplicationBarIconButton()
            {
                Text = "trailer", IconUri = new Uri("/Images/appbar.transport.play.rest.png", UriKind.Relative)
            };
            this.abibTrailer.Click += this.btnViewTrailer_Click;

            this.abibShare = new ApplicationBarIconButton()
            {
                Text = "share", IconUri = new Uri("/Images/appbar.share03.png", UriKind.Relative)
            };
            this.abibShare.Click += this.btnShare_Click;

            this.abibSoundTrack = new ApplicationBarIconButton()
            {
                IconUri = new Uri("/Images/appbar.notes.rest.png", UriKind.Relative), Text = "sounds track"
            };
            this.abibSoundTrack.Click += abibSoundTrack_Click;

            if (!Config.ShowCleanBackground)
            {
                if (SelectedFilm.BackdropUrl != null)
                {
                    this.pMain.Background = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(SelectedFilm.BackdropUrl),
                        Opacity     = 0.2,
                        Stretch     = Stretch.UniformToFill
                    };
                }
                else if (SelectedFilm.MediumPosterUrl != null)
                {
                    this.LayoutRoot.Background = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(SelectedFilm.MediumPosterUrl),
                        Opacity     = 0.2,
                        Stretch     = Stretch.UniformToFill
                    };
                }
            }

            LoadFilmDetails();

            this.ApplicationBar.Buttons.Clear();

            if (!String.IsNullOrWhiteSpace(SelectedFilm.YoutubeTrailer))
            {
                this.ApplicationBar.Buttons.Add(this.abibTrailer);
            }

            this.ApplicationBar.Buttons.Add(this.abibSoundTrack);

            this.ApplicationBar.Buttons.Add(this.abibShare);

            YouTube.CancelPlay();

            bLoaded = true;
        }
Beispiel #9
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     YouTube.CancelPlay();
     Model.IsLoading = false;
 }