public void SearchMedia()
        {
            //Search database for user query

            //Open database connection
            var conn = GetDatabaseConnection();

            conn.Open();
            var command = conn.CreateCommand();

            //Get search string
            string field  = SearchMediaField.TitleOfSelectedItem;
            string search = SearchMediaSearch.StringValue;

            command.CommandText = string.Format("SELECT * FROM media WHERE {0} LIKE '{1}';", field, search);

            //Get IDs of matching results
            SQLiteDataReader reader    = command.ExecuteReader();
            List <string>    recordIDs = new List <string>();

            while (reader.Read())
            {
                string ID = reader.GetString(0);
                recordIDs.Add(ID);
            }
            conn.Close();

            //Get media records and update table
            var DataSource = new MediaTableDataSource();

            foreach (string ID in recordIDs)
            {
                var record = new MediaModel();
                record.Load(conn, ID);
                DataSource.MediaRecords.Add(record);
            }
            MediaTable.DataSource = DataSource;
            MediaTable.Delegate   = new MediaTableDelegate(this, DataSource);
            MediaTable.ReloadData();
        }
 public void ReloadMediaTable()
 {
     MediaTable.ReloadData();
 }