Beispiel #1
0
 private void ShowSaved()
 {
     imageListView1.ShowCheckBoxes = false;
     var db = new SqLiteDatabase();
     var query = "SELECT * FROM arts_" + _seriesId;
     try
     {
         var dt = db.GetDataTable(query);
         imageListView1.Items.Clear();
         for (var i = 0; i < dt.Rows.Count; i++)
         {
             DataRow drow = dt.Rows[i];
             var img1 = new ImageListViewItem {FileName = @drow["image"].ToString()};
             imageListView1.Items.AddRange(new[] { img1 });
         }
     }
     catch(Exception e){
         Console.WriteLine(e.Message);
         var createTable = "CREATE TABLE " + "arts_" + _seriesId + "("
                     + "_id" + " INTEGER PRIMARY KEY,"
                     + "image" + " TEXT"
                     +
                     ")";
         var adb = new ArtsDatabaseEntry(
             "res/" + _seriesName + "_banner.jpg");
         var adb2 = new ArtsDatabaseEntry("res/" + _seriesName + "_poster.jpg");
         var adb3 = new ArtsDatabaseEntry(
             "res/" + _seriesName + "_fanart.jpg");
         try
         {
             db.CreateTable(createTable);
             db.InsertArts(adb, "arts_" + _seriesId);
             db.InsertArts(adb2, "arts_" + _seriesId);
             db.InsertArts(adb3, "arts_" + _seriesId);
             ShowSaved();
         }
         catch (Exception crap)
         {
             MessageBox.Show(crap.Message);
         }
     }
 }
Beispiel #2
0
 private void save_Click(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     var db = new SqLiteDatabase();
     foreach(var i in imageListView1.CheckedItems){
         File.Copy(i.FileName, @"res/"+Path.GetFileName(i.FileName));
         try{
             db.InsertArts(new ArtsDatabaseEntry("res/" + Path.GetFileName(i.FileName)), "arts_" + _seriesId);
         }
         catch(Exception ex){
             MessageBox.Show(ex.Message);
         }
     }
     ShowSaved();
     Cursor = Cursors.Default;
 }