Example #1
0
        private async void Seen_Click(object sender, EventArgs e)
        {
            if (!LoadingActive)
            {
                App.TrackEvent("ViewEpisode", "Seen");

                LoadingActive = true;
                progressBarLoading.Visibility = System.Windows.Visibility.Visible;

                if (await episodeController.markEpisodeAsSeen(this.show.tvdb_id, this.show.imdb_id, this.show.Title, this.show.year, this.episode.Season, this.episode.Number))
                {
                    ToastNotification.ShowToast("Episode", "Episode marked as watched.");
                    App.EpisodeViewModel.Watched = true;
                    await updateOtherViews();

                    InitAppBar();
                }
                else
                {
                    ErrorManager.ShowConnectionErrorPopup();
                }
                progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
                LoadingActive = false;
            }
        }
Example #2
0
        private async void SeasonWatchedIconButton_Click(object sender, EventArgs e)
        {
            if (!this.LoadingActive)
            {
                this.LoadingActive = true;
                App.TrackEvent("ViewShow", "Season watched");
                progressBarLoading.Visibility = System.Windows.Visibility.Visible;
                if (await this.showController.markShowSeasonAsSeen(this.Show, App.ShowViewModel.currentSeason))
                {
                    ToastNotification.ShowToast("Show", "Season marked as watched.");
                    foreach (ListItemViewModel model in App.ShowViewModel.EpisodeItems)
                    {
                        if (!String.IsNullOrEmpty(model.Tvdb))
                        {
                            model.Watched = true;
                        }
                    }
                }
                else
                {
                    ErrorManager.ShowConnectionErrorPopup();
                }

                progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;

                this.LoadingActive = false;
            }
        }
Example #3
0
        private async void CheckinEpisode_Click(object sender, RoutedEventArgs e)
        {
            this.indicator = App.ShowLoading(this);
            lastModel      = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await episodeController.checkinEpisode(lastModel.Tvdb, lastModel.Name, lastModel.Year, lastModel.Season, lastModel.Episode))
            {
                if (lastModel != null)
                {
                    lastModel.Watched = true;
                }
                TraktShow show = await showController.getShowByTVDBID(lastModel.Tvdb);

                ShowWatchingNowShow(await episodeController.getEpisodeByTvdbAndSeasonInfo(lastModel.Tvdb, lastModel.Season, lastModel.Episode, show), show, DateTime.UtcNow);

                ToastNotification.ShowToast("Show", "Checked in!");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            lastModel = null;
            this.indicator.IsVisible = false;
        }
Example #4
0
        private async void CheckinEpisode_Click(object sender, RoutedEventArgs e)
        {
            this.progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;
            App.TrackEvent("ViewShow", "Checkin context");

            if (await episodeController.checkinEpisode(lastModel.Tvdb, App.ShowViewModel.Name, Int16.Parse(App.ShowViewModel.Year), lastModel.Season, lastModel.Episode))
            {
                lastModel.Watched = true;
                TraktShow show = await showController.getShowByTVDBID(lastModel.Tvdb);

                try
                {
                    App.MainPage.ShowWatchingNowShow(await episodeController.getEpisodeByTvdbAndSeasonInfo(lastModel.Tvdb, lastModel.Season, lastModel.Episode, show), show, DateTime.UtcNow);
                }
                catch (NullReferenceException) { }
                ToastNotification.ShowToast("Show", "Checked in!");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            lastModel = null;
            this.progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #5
0
        private async Task Signin()
        {
            if (!String.IsNullOrEmpty(this.LoginBox.Text) && !String.IsNullOrEmpty(this.PasswordBox.Password))
            {
                AppUser.Instance.UserName = this.LoginBox.Text;
                AppUser.Instance.Password = this.PasswordBox.Password;

                SigninButton.Visibility = System.Windows.Visibility.Collapsed;
                JoinButton.Visibility   = System.Windows.Visibility.Collapsed;
                progressBar.Visibility  = System.Windows.Visibility.Visible;


                if (await userController.ValidateUser())
                {
                    NavigationService.GoBack();
                    ToastNotification.ShowToast("Success!", "You have been logged in!");
                }
                else
                {
                    SigninButton.Visibility = System.Windows.Visibility.Visible;
                    JoinButton.Visibility   = System.Windows.Visibility.Visible;
                    progressBar.Visibility  = System.Windows.Visibility.Collapsed;
                    ToastNotification.ShowToast("Error!", "Login data incorrect, or server connection problems.");
                }
            }
            else
            {
                ToastNotification.ShowToast("Error!", "Please fill in all required fields!");
            }
        }
Example #6
0
        void tileMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                App.TrackEvent("ViewMovie", "Create tile");
                if (StorageController.doesFileExist(App.MovieViewModel.Imdb + "background.jpg"))
                {
                    ImageController.copyImageToShellContent(App.MovieViewModel.Imdb + "background.jpg", App.MovieViewModel.Imdb);
                    FlipTileData NewTileData = new FlipTileData
                    {
                        BackgroundImage =
                            new Uri("isostore:/Shared/ShellContent/wptraktbg" + App.MovieViewModel.Imdb + ".jpg", UriKind.Absolute),
                        WideBackgroundImage =
                            new Uri("isostore:/Shared/ShellContent/wptraktbg" + App.MovieViewModel.Imdb + ".jpg", UriKind.Absolute),
                        Title = App.MovieViewModel.Name,
                    };

                    ShellTile.Create(
                        new Uri(
                            "/ViewMovie.xaml?id=" + App.MovieViewModel.Imdb,
                            UriKind.Relative),
                        NewTileData, true);
                }
            }
            catch (InvalidOperationException) { ToastNotification.ShowToast("Tile", "Error creating tile, please try again!"); }
        }
Example #7
0
 private void ValidationFailed()
 {
     App.ViewModel.Profile    = null;
     this.indicator.IsVisible = false;
     App.TrackEvent("MainPage", "Failed login");
     NavigationService.Navigate(new Uri("/Login.xaml", UriKind.Relative));
     ToastNotification.ShowToast("User incorrect!", "Login data incorrect, or server connection problems.");
 }
Example #8
0
        private void CreateHistoryList(List <TraktActivity> newsFeedActivity)
        {
            int counter = 0;

            sortedOrderHistory = null;
            newsFeedActivity.Sort(TraktActivity.ActivityComparison);
            foreach (TraktActivity activity in newsFeedActivity)
            {
                ActivityListItemViewModel tempModel = null;

                if (counter++ <= 60)
                {
                    switch (activity.Action)
                    {
                    case "checkin":
                        tempModel = Checkin(activity);
                        break;

                    case "scrobble":
                        tempModel = Scrobble(activity);
                        break;
                    }

                    if (tempModel != null)
                    {
                        OrderHistory(activity, tempModel);
                    }
                }
            }

            if (sortedOrderHistory != null)
            {
                foreach (DateTime key in sortedOrderHistory.Keys)
                {
                    Boolean isFirst = true;

                    foreach (ActivityListItemViewModel model in sortedOrderHistory[key])
                    {
                        if (isFirst)
                        {
                            model.HasHeader = true;
                            isFirst         = false;
                        }

                        App.CheckinHistoryViewModel.HistoryItems.Add(model);
                    }
                }
            }

            if (newsFeedActivity.Count == 0)
            {
                ToastNotification.ShowToast("User", "History list is empty!");
            }

            App.CheckinHistoryViewModel.NotifyPropertyChanged("HistoryItems");
            indicator.IsVisible = false;
        }
Example #9
0
        void OnTimerTick(object sender, EventArgs e)
        {
            int seconds = (DateTime.Now - firstCall).Seconds;

            if (seconds > 10)
            {
                App.TrackEvent("MainPage", "Slow connection to trakt");
                ToastNotification.ShowToast("Connection", "Slow connection to trakt!");
                userValidationTimer.Stop();
            }
        }
Example #10
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Opacity = 1;
            if (App.ViewModel.Profile != null)
            {
                lastModel = null;
                StorageController.IsNetworkStateCached = false;
                return;
            }

            try
            {
                if (!NetworkInterface.GetIsNetworkAvailable())
                {
                    App.TrackEvent("MainPage", "No internet connection");
                    ToastNotification.ShowToast("Connection", "No connection available!");
                    return;
                }

                var assembly          = Assembly.GetExecutingAssembly().FullName;
                var fullVersionNumber = assembly.Split('=')[1].Split(',')[0];

                if ((String.IsNullOrEmpty(AppUser.Instance.UserName) || String.IsNullOrEmpty(AppUser.Instance.Password)))
                {
                    App.TrackEvent("MainPage", "New user");
                    AppUser.Instance.AppVersion = fullVersionNumber;

                    NavigationService.Navigate(new Uri("/Login.xaml", UriKind.Relative));
                }
                else
                {
                    if (AppUser.Instance.AppVersion != fullVersionNumber)
                    {
                        MessageBox.Show("Application update. Clearing cache, the application will hang for a few seconds.");
                        App.TrackEvent("MainPage", "Updating application");

                        AppUser.ClearCache();
                        AppUser.Instance.AppVersion = fullVersionNumber;
                    }

                    if (!AppUser.Instance.SmallScreenshotsEnabled && !(AppUser.Instance.ImagesWithWIFI && StorageController.IsConnectedToWifi()))
                    {
                        this.TrendingPanoramaItem.Visibility = System.Windows.Visibility.Collapsed;
                    }

                    LoadProfile();

                    TileHelper.StartReloadLiveTile();
                }
            }
            catch (InvalidOperationException error) {
                GoogleAnalytics.EasyTracker.GetTracker().SendException(error.Message, false);
            }
        }
Example #11
0
 private async void unFollowButton_Click(object sender, EventArgs e)
 {
     if (await userController.unFollowUser(this.username))
     {
         ToastNotification.ShowToast("User", "Unfollowing this user!");
         createFollowButton();
         AppUser.Instance.Friends.Remove(this.username);
     }
     else
     {
         ErrorManager.ShowConnectionErrorPopup();
     }
 }
Example #12
0
        private async void CheckinMovie_Click(object sender, RoutedEventArgs e)
        {
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await movieController.checkinMovie(lastModel.Imdb, lastModel.Name, lastModel.Year))
            {
                ShowWatchingNowMovie(await movieController.getMovieByImdbId(lastModel.Imdb), DateTime.UtcNow);
                ToastNotification.ShowToast("Movie", "Checked in!");
            }
            else
            {
                ToastNotification.ShowToast("Movie", "There is already a checkin in progress.");
            }
        }
Example #13
0
        private async void WatchlistMovie_Click(object sender, RoutedEventArgs e)
        {
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await movieController.addMovieToWatchlist(lastModel.Imdb, lastModel.Name, lastModel.Year))
            {
                lastModel.InWatchList = true;
                ToastNotification.ShowToast("Movie", "Movie added to watchlist.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            lastModel = null;
        }
Example #14
0
        private void client_UploadMovieSeenStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                String jsonString = e.Result;
                lastModel.Watched = true;
                ToastNotification.ShowToast("Movie", "Movie marked as watched.");
            }
            catch (WebException)
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            catch (TargetInvocationException) { ErrorManager.ShowConnectionErrorPopup(); }

            lastModel = null;
        }
Example #15
0
        private async void SeenMovie_Click(object sender, RoutedEventArgs e)
        {
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await movieController.markMovieAsSeen(lastModel.Imdb, lastModel.Name, lastModel.Year))
            {
                lastModel.Watched = true;
                ToastNotification.ShowToast("Movie", "Movie marked as watched.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            lastModel = null;
        }
Example #16
0
 private async void SeenClick(object sender, EventArgs e)
 {
     App.TrackEvent("ViewMovie", "Seen");
     progressBarLoading.Visibility = System.Windows.Visibility.Visible;
     if (await movieController.markMovieAsSeen(this.Movie.imdb_id, this.Movie.Title, this.Movie.year))
     {
         ToastNotification.ShowToast("Movie", "Movie marked as watched.");
         App.MovieViewModel.Watched = true;
         InitAppBar();
     }
     else
     {
         ErrorManager.ShowConnectionErrorPopup();
     }
     progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
 }
Example #17
0
 private async void removeFromWatchlist_Click(object sender, EventArgs e)
 {
     progressBarLoading.Visibility = System.Windows.Visibility.Visible;
     App.TrackEvent("ViewMovie", "Unwatchlist");
     if (await this.movieController.removeMovieFromWatchlist(this.Movie.imdb_id, this.Movie.Title, this.Movie.year))
     {
         App.MovieViewModel.InWatchlist = false;
         ToastNotification.ShowToast("Movie", "Movie removed from watchlist.");
         InitAppBar();
     }
     else
     {
         ErrorManager.ShowConnectionErrorPopup();
     }
     progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
 }
Example #18
0
        void client_UploadMovieWatchlistStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                String jsonString = e.Result;
                lastModel.InWatchList = true;
                ToastNotification.ShowToast("Movie", "Movie added to watchlist.");
            }
            catch (WebException)
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            catch (TargetInvocationException) { ErrorManager.ShowConnectionErrorPopup(); }

            lastModel = null;
        }
Example #19
0
        private async void WatchedIconButton_Click(object sender, EventArgs e)
        {
            App.TrackEvent("ViewShow", "Watched");
            progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            if (await showController.markShowAsSeen(this.Show.imdb_id, this.Show.Title, this.Show.year))
            {
                ToastNotification.ShowToast("Show", "Show marked as watched.");
                App.ShowViewModel.Watched = true;
                InitAppBarMain();
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #20
0
        private async void removeFromWatchlist_Click(object sender, EventArgs e)
        {
            App.TrackEvent("ViewShow", "Unwatchlist");
            progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            if (await this.showController.removeShowFromWatchlist(this.Show.tvdb_id, this.Show.imdb_id, this.Show.Title, this.Show.year))
            {
                ToastNotification.ShowToast("Show", "Show removed from watchlist.");
                App.ShowViewModel.InWatchlist = false;
                InitAppBarMain();
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #21
0
 private async void sendButton_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty((ShoutText.Text)))
     {
         App.TrackEvent("ViewShow", "Add shout");
         if (await this.showController.addShoutToShow(ShoutText.Text, this.Show.imdb_id, this.Show.Title, this.Show.year))
         {
             ToastNotification.ShowToast("Show", "Shout posted.");
             ShoutText.Text = "";
             this.Focus();
         }
         else
         {
             ErrorManager.ShowConnectionErrorPopup();
         }
     }
 }
Example #22
0
        private async void CancelCheckinEpisode_Click_1(object sender, RoutedEventArgs e)
        {
            lastModel      = (ListItemViewModel)((MenuItem)sender).DataContext;
            this.indicator = App.ShowLoading(this);
            if (await userController.CancelActiveCheckin())
            {
                ClearWatchingNow();
                ToastNotification.ShowToast("Cancel", "Cancelled any active check in!");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            this.indicator.IsVisible = false;
            lastModel = null;
        }
Example #23
0
        private async void SeenEpisode_Click(object sender, RoutedEventArgs e)
        {
            this.indicator = App.ShowLoading(this);
            lastModel      = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await episodeController.markEpisodeAsSeen(lastModel.Tvdb, lastModel.Imdb, lastModel.Name, lastModel.Year, lastModel.Season, lastModel.Episode))
            {
                lastModel.Watched = true;
                ToastNotification.ShowToast("Show", "Episode marked as watched.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            lastModel = null;
            this.indicator.IsVisible = false;
        }
Example #24
0
        private async void sendButton_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty((ShoutText.Text)))
            {
                if (await episodeController.addShoutToEpisode(ShoutText.Text, this.show.tvdb_id, this.show.Title, this.show.year, this.episode.Season, this.episode.Number))
                {
                    ToastNotification.ShowToast("Episode", "Shout posted.");

                    ShoutText.Text = "";

                    this.Focus();
                }
                else
                {
                    ErrorManager.ShowConnectionErrorPopup();
                }
            }
        }
Example #25
0
        private async void RemoveWatchlistEpisode_Click(object sender, RoutedEventArgs e)
        {
            this.indicator = App.ShowLoading(this);
            lastModel      = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await episodeController.removeEpisodeFromWatchlist(lastModel.Tvdb, lastModel.Imdb, lastModel.Name, lastModel.Year, lastModel.Season, lastModel.Episode))
            {
                lastModel.InWatchList = false;
                ToastNotification.ShowToast("Show", "Episode removed from watchlist.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            lastModel = null;
            this.indicator.IsVisible = false;
        }
Example #26
0
        private async void disabledAddtoWatchlist_Click(object sender, EventArgs e)
        {
            App.TrackEvent("ViewShow", "Watchlist");
            progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            if (await this.showController.addShowToWatchlist(this.Show.tvdb_id, this.Show.imdb_id, this.Show.Title, this.Show.year))
            {
                App.ShowViewModel.InWatchlist = true;

                ToastNotification.ShowToast("Show", "Show added to watchlist.");

                InitAppBarMain();
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #27
0
        private async void removeFromWatchlist_Click(object sender, EventArgs e)
        {
            progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            App.TrackEvent("ViewEpisode", "Unwatchlist");

            if (await episodeController.removeEpisodeFromWatchlist(this.show.tvdb_id, this.show.imdb_id, this.show.Title, this.show.year, this.episode.Season, this.episode.Number))
            {
                ToastNotification.ShowToast("Episode", "Episode removed from watchlist.");
                App.EpisodeViewModel.InWatchlist = false;
                await updateOtherViews();

                InitAppBar();
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #28
0
        private async void SeenEpisode_Click(object sender, RoutedEventArgs e)
        {
            this.progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            App.TrackEvent("ViewShow", "Seen context");

            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await episodeController.markEpisodeAsSeen(lastModel.Tvdb, App.ShowViewModel.Imdb, App.ShowViewModel.Name, Int16.Parse(App.ShowViewModel.Year), lastModel.Season, lastModel.Episode))
            {
                lastModel.Watched = true;
                ToastNotification.ShowToast("Show", "Episode marked as watched.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }
            lastModel = null;
            this.progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #29
0
        private async void RemoveWatchlistEpisode_Click(object sender, RoutedEventArgs e)
        {
            App.TrackEvent("ViewShow", "Unwatchlist context");
            this.progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;

            if (await episodeController.removeEpisodeFromWatchlist(lastModel.Tvdb, App.ShowViewModel.Imdb, App.ShowViewModel.Name, Int16.Parse(App.ShowViewModel.Year), lastModel.Season, lastModel.Episode))
            {
                lastModel.InWatchList = false;
                ToastNotification.ShowToast("Show", "Episode removed from watchlist.");
            }
            else
            {
                ErrorManager.ShowConnectionErrorPopup();
            }

            lastModel = null;
            this.progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #30
0
        private async void checkinButton_Click(object sender, EventArgs e)
        {
            progressBarLoading.Visibility = System.Windows.Visibility.Visible;
            App.TrackEvent("ViewMovie", "Checkin");
            if (await this.movieController.checkinMovie(this.Movie.imdb_id, this.Movie.Title, this.Movie.year))
            {
                try
                {
                    App.MainPage.ShowWatchingNowMovie(this.Movie, DateTime.UtcNow);
                }
                catch (NullReferenceException) { }
                ToastNotification.ShowToast("Movie", "Checked in!");
            }
            else
            {
                ToastNotification.ShowToast("Movie", "There is already a checkin in progress or connection problem!");
            }

            progressBarLoading.Visibility = System.Windows.Visibility.Collapsed;
        }