Esempio n. 1
0
        private async void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            Button      bt = sender as Button;
            Contentlist cl = bt.DataContext as Contentlist;

            sqliteHelper.CreateDB();
            List <Model.Download> DL = sqliteHelper.CheckData(cl.name);
            bool checkresult         = false;

            foreach (Model.Download i in DL)
            {
                if (i.name == cl.name)
                {
                    checkresult = true;
                }
            }
            if (checkresult)
            {
                var dialog = new MessageDialog("已经添加过下载了", "yoho");
                dialog.Commands.Add(new UICommand("确定", cmd => { }));
                await dialog.ShowAsync();

                return;
            }
            Model.Download AddDownload = new Model.Download();
            AddDownload.name          = cl.name;
            AddDownload.love          = cl.love;
            AddDownload.hate          = cl.hate;
            AddDownload.profile_image = cl.profile_image;
            AddDownload.text          = cl.text;
            AddDownload.video_uri     = cl.video_uri;
            AddDownload.create_time   = cl.create_time;
            sqliteHelper.AddData(AddDownload);
            StorageFile File = await NetWork.DownLoad.DownLoadVideo(cl.video_uri);
        }
Esempio n. 2
0
        private async void Favorite_Click(object sender, RoutedEventArgs e)
        {
            sqliteHelper.CreateDB();
            Button button           = sender as Button;
            Datum1 data             = button.DataContext as Datum1;
            List <FavoriteData> fav = sqliteHelper.CheckData(data.tvTitle);
            int CheckDataResult     = 0;

            foreach (FavoriteData i in fav)
            {
                if (i.tvTitle == data.tvTitle)
                {
                    CheckDataResult = 1;
                }
            }
            if (CheckDataResult == 1)
            {
                var dialog = new MessageDialog("你已经收藏过了厚", "yoho");
                dialog.Commands.Add(new UICommand("确定", cmd => { }));
                var a = await dialog.ShowAsync();
            }
            else
            {
                FavoriteData Addfavorite = new FavoriteData();
                Addfavorite.tvTitle     = data.tvTitle;
                Addfavorite.iconaddress = data.iconaddress;
                Addfavorite.grade       = data.grade;
                Addfavorite.gradeNum    = data.gradeNum;
                Addfavorite.data2       = data.playDate.data2;
                Addfavorite.director1   = data.director.data.a.name;
                if (data.director.data.b != null)
                {
                    Addfavorite.director2 = data.director.data.b.name;
                }
                Addfavorite.star1 = data.star.data.a.name;
                if (data.star.data.b != null)
                {
                    Addfavorite.star2 = data.star.data.b.name;
                }
                if (data.star.data.c != null)
                {
                    Addfavorite.star3 = data.star.data.c.name;
                }
                if (data.star.data.d != null)
                {
                    Addfavorite.star4 = data.star.data.d.name;
                }
                Addfavorite.type1 = data.type.data.a.name;
                if (data.type.data.b != null)
                {
                    Addfavorite.type2 = data.type.data.b.name;
                }
                if (data.type.data.c != null)
                {
                    Addfavorite.type3 = data.type.data.c.name;
                }
                if (data.type.data.d != null)
                {
                    Addfavorite.type4 = data.type.data.d.name;
                }
                if (data.type.data.e != null)
                {
                    Addfavorite.type5 = data.type.data.e.name;
                }
                Addfavorite.storyBrief    = data.story.data.storyBrief;
                Addfavorite.MovieImage    = data.more.data[1].link;
                Addfavorite.MovieDiscuss  = data.more.data[2].link;
                Addfavorite.storyMoreLink = data.story.data.storyMoreLink;
                sqliteHelper.AddData(Addfavorite);
            }
        }