Beispiel #1
0
 private void RefreshDataDefault()
 {
     gv.DataSource = null;
     gv.DataSource = YUDBContext.GetInstance().Videos
                     .OrderByDescending(x => x.Id)
                     .Take(20)
                     .ToList();
 }
Beispiel #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (var ctx = YUDBContext.GetInstance())
     {
         ctx.Videos.Add(new Video {
             Path = this.Path, Position = this.Position, PositionStr = this.PositionStr, Key = txtKey.Text, SnapShot = this.SnapShot
         });
         ctx.SaveChanges();
         this.Close();
     }
 }
Beispiel #3
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (txtSearch.Text.Trim().Length > 0)
         {
             gv.DataSource = null;
             gv.DataSource = YUDBContext.GetInstance().Videos
                             .Where(x => x.Key.Contains(txtSearch.Text.Trim()))
                             .OrderByDescending(x => x.Id)
                             .ToList();
         }
         else
         {
             RefreshDataDefault();
         }
         txtSearch.SelectAll();
     }
 }