コード例 #1
0
        private async void Item_Tapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            item = sender as Grid;
            ep   = item.DataContext as Episode;

            Image ima = item.FindName("ima") as Image;

            if (ima.Opacity > 0.5)
            {
                if (!ep.Aired)
                {
                    Helper.message("This episode hasn't aired yet. You cannot mark it as watched", "EPISODE NOT AIRED");
                    return;
                }

                DoubleAnimation ani = new DoubleAnimation();
                Storyboard.SetTarget(ani, ima);

                Storyboard board = new Storyboard();
                board.Completed += board_Completed;
                Storyboard.SetTargetProperty(ani, "Opacity");
                ani.To         = 0.2;
                ep.Opacity     = 0.2;
                board.Duration = new Duration(TimeSpan.FromSeconds(1));
                board.Children.Add(ani);

                board.Begin();
            }
            else
            {
                DoubleAnimation ani = new DoubleAnimation();
                Storyboard.SetTarget(ani, ima);

                Storyboard board = new Storyboard();
                Storyboard.SetTargetProperty(ani, "Opacity");
                ani.To         = 0.9;
                board.Duration = new Duration(TimeSpan.FromSeconds(1));
                board.Children.Add(ani);

                board.Begin();

                ep.Seen = false;

                ep.OnPropertyChanged("redo");
                ep.OnPropertyChanged("Opacity");

                if (api.hasInternet())
                {
                    await ep.markNotAsWatched();
                }
                else
                {
                    Command com = new Command();
                    com.episode = ep;
                    com.watched = false;

                    api.addCommand(com);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            StatusBar statusBar = StatusBar.GetForCurrentView();
            // Hide the status bar
            await statusBar.HideAsync();

            ////Loading
            api = API.getAPI();

            //As a precaution set a show as the passed object
            TvShow show = new TvShow(false);

            api.passed = show;

            if (api.hasInternet())
            {
                LoadLists();
            }
            else
            {
                List <Episode> list = await api.recoverQueue();

                List <TvShow> listTV = await api.recoverTracker();

                List <Episode> cal = await api.recoverCalendar();

                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    if (list.Count > 0)
                    {
                        queue.ItemsSource = list;
                    }

                    if (listTV.Count > 0)
                    {
                        tracker.ItemsSource = listTV;
                    }

                    if (cal.Count > 0)
                    {
                        if (cal != null)
                        {
                            var result =
                                from ep in cal
                                group ep by ep.airdate
                                into grp
                                orderby grp.Key
                                select grp;
                            calendar.Source = result;
                        }
                    }


                    //q = list;
                });


                //Wait for when we do have internet
                api.getNetwork().PropertyChanged += NetworkStatus_Changed;
            }


            Tile.setTile(0);
        }