예제 #1
0
        private void FindByIdScms(int queryId)
        {
            if (queryId != -1)
            {
                int[] seedTrackIds = new int[] { queryId };

                AudioFeature m1 = db.GetTrack(queryId, analysisMethod);

                if (m1 != null)
                {
                    // Add the found similar tracks
                    var similarTracks = Mir.SimilarTracksList(seedTrackIds, seedTrackIds, db, analysisMethod, DEFAULT_NUM_TO_TAKE, percentage, distanceType);

                    // Add the one we are querying with at the top
                    similarTracks.Insert(0, new QueryResult(queryId, m1.Name, m1.Duration, 0));

                    queryResultList = new BindingList <QueryResult>(similarTracks);

                    bs.DataSource            = queryResultList;
                    dataGridView1.DataSource = queryResultList;

                    this.dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    this.dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                }
                else
                {
                    MessageBox.Show("File-id does not exist!");
                }
            }
        }
예제 #2
0
        private void FindByFilePathScms(string queryPath)
        {
            if (queryPath != "")
            {
                FileInfo fi = new FileInfo(queryPath);

                if (fi.Exists)
                {
                    // Add the found similar tracks
                    var similarTracks = Mir.SimilarTracksList(queryPath, db, analysisMethod, DEFAULT_NUM_TO_TAKE, percentage, distanceType);

                    // Add the one we are querying with at the top
                    similarTracks.Insert(0, new QueryResult(0, queryPath, 0, 0));

                    queryResultList = new BindingList <QueryResult>(similarTracks);

                    bs.DataSource            = queryResultList;
                    dataGridView1.DataSource = queryResultList;

                    this.dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    this.dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                }
                else
                {
                    MessageBox.Show("File does not exist!");
                }
            }
        }