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); }
private void MyListView_ItemClick(object sender, ItemClickEventArgs e) { ListView lv = sender as ListView; Contentlist cl = e.ClickedItem as Contentlist; Uri uri = new Uri(cl.video_uri); Grid gr1 = lv.Parent as Grid; Grid gr2 = gr1.Parent as Grid; Home home = gr2.Parent as Home; Frame fr = home.Parent as Frame; if (Grid.GetColumnSpan(fr) == 2) { if (this.Frame != null) { fr.Navigate(typeof(SecondFrame)); SecondFrame sf2 = fr.Content as SecondFrame; Grid gr6 = sf2.Content as Grid; Grid gr7 = gr6.Children[1] as Grid; MediaElement player2 = gr7.Children[0] as MediaElement; player2.Source = uri; } return; } Grid gr3 = fr.Parent as Grid; Frame fr2 = gr3.Children[0] as Frame; SecondFrame sf = fr2.Content as SecondFrame; Grid gr4 = sf.Content as Grid; Grid gr5 = gr4.Children[1] as Grid; MediaElement player = gr5.Children[0] as MediaElement; player.Source = uri; sqliteHelper1.CreateDB(); List <Model.History> His = sqliteHelper1.CheckData(cl.name); Model.History AddHistory = new Model.History(); AddHistory.name = cl.name; AddHistory.love = cl.love; AddHistory.hate = cl.hate; AddHistory.profile_image = cl.profile_image; AddHistory.text = cl.text; AddHistory.video_uri = cl.video_uri; AddHistory.create_time = cl.create_time; AddHistory.time = DateTime.Now.ToString(); sqliteHelper1.AddData(AddHistory); }
private void MyVideo_ItemClick(object sender, ItemClickEventArgs e) { //GetSelectedItemFromListView(MyVideo); //无法获取点击item的值 //if(a!=null) //{ // string uri; // uri = a.ToString(); //} try { Contentlist a = MyVideo.SelectedItem as Contentlist; myuri = a.video_uri; myplayer.Source = new Uri(myuri); myplayer.Visibility = Visibility.Visible; //不急 } catch { //先不急 } }