private void SearchResultsListForm_Load(object sender, EventArgs e) { _db = new SqLiteDatabase(); _result = HttpHelper.HttpGet("http://thetvdb.com/api/GetSeries.php?seriesname="+_query); //Console.WriteLine(result); _namesList = new List<SearchResultsEntry>(); XDocument doc = XDocument.Parse(_result); // var names = doc.Descendants("Series"); var names = from ele in doc.Descendants("Series") select new { seriesName = (string)ele.Element("SeriesName"), overview = (string)ele.Element("Overview"), lang = (string)ele.Element("language"), id = (int)ele.Element("seriesid") }; foreach (var n in names) { _namesList.Add(new SearchResultsEntry(n.seriesName, n.lang, n.overview, n.id)); } searchResults.Items.Clear(); foreach (ListViewItem item in _namesList.Select(s => new ListViewItem(s.GetName()))) { searchResults.Items.Add(item); } _mainForm.Cursor = Cursors.Default; }
private void Form1_Load(object sender, EventArgs e) { _db = new SqLiteDatabase(); if (File.Exists(@"tvdb.db")) { UpdateShowList(); } else { CreateDatabase(); } CheckUpdate(); }
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; }
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); } } }
private void Agenda_Load(object sender, EventArgs e) { _db = new SqLiteDatabase(); UpdateList(); }