Пример #1
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     pivot = sender as Pivot;
            TextBlock txt   = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < pivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            switch (pivot.SelectedIndex)
            {
            case 0:
            {
                if (gv_hot.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(166, 1);

                    foreach (var item in temp)
                    {
                        gv_hot.Items.Add(item);
                    }
                }
            }
            break;
            }
        }
Пример #2
0
        private void GridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            GridView gridview = sender as GridView;
            var      scroll   = Load.FindChildOfType <ScrollViewer>(gridview);
            var      text     = Load.FindChildOfType <TextBlock>(gridview);

            scroll.ViewChanged += async(s, a) =>
            {
                if ((scroll.VerticalOffset >= scroll.ScrollableHeight - 50 || scroll.ScrollableHeight == 0) && !isLoading)
                {
                    text.Visibility = Visibility.Visible;
                    int count0 = gridview.Items.Count;
                    int page   = gridview.Items.Count / 20 + 1;
                    isLoading = true;
                    List <Content> temps = await ContentServ.GetContentAsync(int.Parse(gridview.Tag.ToString()), page);

                    if (temps.Count == 0)
                    {
                        text.Text = "装填完毕!";
                        return;
                    }
                    text.Visibility = Visibility.Collapsed;
                    foreach (var item in temps)
                    {
                        gridview.Items.Add(item);
                    }
                    isLoading = false;
                }
            };
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tid"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        private async Task LoadItems(GridView gridview, int tid, int page)
        {
            //int count=
            List <Content> a = await ContentServ.GetContentAsync(tid, page, 6);

            if (a != null)
            {
                gridview.ItemsSource = a;
            }
        }
Пример #4
0
        private async Task LoadItems(int tid, int page)
        {
            GridView gridview = FindName("gridview" + tid) as GridView;

            if (gridview != null)
            {
                List <Content> a = await ContentServ.GetContentAsync(tid, page, size);

                if (a != null)
                {
                    gridview.ItemsSource = a;
                }
            }
        }
Пример #5
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     pivot = sender as Pivot;
            TextBlock txt   = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < pivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            switch (pivot.SelectedIndex)
            {
            case 0:
            {
                if (gv_hot.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(160, 1);

                    foreach (var item in temp)
                    {
                        gv_hot.Items.Add(item);
                    }
                }
            }
            break;

            case 1:
            {
                if (gv_humor.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(138, 1);

                    foreach (var item in temp)
                    {
                        gv_humor.Items.Add(item);
                    }
                }
            }
            break;

            case 2:
            {
                if (gv_daily.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(21, 1);

                    foreach (var item in temp)
                    {
                        gv_daily.Items.Add(item);
                    }
                }
            }
            break;

            case 3:
            {
                if (gv_food.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(76, 1);

                    foreach (var item in temp)
                    {
                        gv_food.Items.Add(item);
                    }
                }
            }
            break;

            case 4:
            {
                if (gv_animal.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(75, 1);

                    foreach (var item in temp)
                    {
                        gv_animal.Items.Add(item);
                    }
                }
            }
            break;

            case 5:
            {
                if (gv_craft.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(161, 1);

                    foreach (var item in temp)
                    {
                        gv_craft.Items.Add(item);
                    }
                }
            }
            break;

            case 6:
            {
                if (gv_draw.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(162, 1);

                    foreach (var item in temp)
                    {
                        gv_draw.Items.Add(item);
                    }
                }
            }
            break;

            case 7:
            {
                if (gv_sport.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(163, 1);

                    foreach (var item in temp)
                    {
                        gv_sport.Items.Add(item);
                    }
                }
            }
            break;
            }
        }
Пример #6
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     pivot = sender as Pivot;
            TextBlock txt   = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < pivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            switch (pivot.SelectedIndex)
            {
            case 0:
            {
                if (gv_hot.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(3, 1);

                    foreach (var item in temp)
                    {
                        gv_hot.Items.Add(item);
                    }
                }
            }
            break;

            case 1:
            {
                if (gv_ori.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(28, 1);

                    foreach (var item in temp)
                    {
                        gv_ori.Items.Add(item);
                    }
                }
            }
            break;

            case 2:
            {
                if (gv_resing.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(31, 1);

                    foreach (var item in temp)
                    {
                        gv_resing.Items.Add(item);
                    }
                }
            }
            break;

            case 3:
            {
                if (gv_vo.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(30, 1);

                    foreach (var item in temp)
                    {
                        gv_vo.Items.Add(item);
                    }
                }
            }
            break;

            case 4:
            {
                if (gv_play.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(59, 1);

                    foreach (var item in temp)
                    {
                        gv_play.Items.Add(item);
                    }
                }
            }
            break;

            case 5:
            {
                if (gv_third.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(29, 1);

                    foreach (var item in temp)
                    {
                        gv_third.Items.Add(item);
                    }
                }
            }
            break;

            case 6:
            {
                if (gv_oped.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(54, 1);

                    foreach (var item in temp)
                    {
                        gv_oped.Items.Add(item);
                    }
                }
            }
            break;

            case 7:
            {
                if (gv_album.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(130, 1);

                    foreach (var item in temp)
                    {
                        gv_album.Items.Add(item);
                    }
                }
            }
            break;
            }
        }
Пример #7
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     pivot = sender as Pivot;
            TextBlock txt   = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < pivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            switch (pivot.SelectedIndex)
            {
            case 0:
            {
                if (gv_hot.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(36, 1);

                    foreach (var item in temp)
                    {
                        gv_hot.Items.Add(item);
                    }
                }
            }
            break;

            case 1:
            {
                if (gv_documentary.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(37, 1);

                    foreach (var item in temp)
                    {
                        gv_documentary.Items.Add(item);
                    }
                }
            }
            break;

            case 2:
            {
                if (gv_fun.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(124, 1);

                    foreach (var item in temp)
                    {
                        gv_fun.Items.Add(item);
                    }
                }
            }
            break;

            case 3:
            {
                if (gv_ani.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(122, 1);

                    foreach (var item in temp)
                    {
                        gv_ani.Items.Add(item);
                    }
                }
            }
            break;

            case 4:
            {
                if (gv_class.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(39, 1);

                    foreach (var item in temp)
                    {
                        gv_class.Items.Add(item);
                    }
                }
            }
            break;

            case 5:
            {
                if (gv_star.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(96, 1);

                    foreach (var item in temp)
                    {
                        gv_star.Items.Add(item);
                    }
                }
            }
            break;

            case 6:
            {
                if (gv_digital.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(95, 1);

                    foreach (var item in temp)
                    {
                        gv_digital.Items.Add(item);
                    }
                }
            }
            break;

            case 7:
            {
                if (gv_machine.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(98, 1);

                    foreach (var item in temp)
                    {
                        gv_machine.Items.Add(item);
                    }
                }
            }
            break;
            }
        }