protected override void OnDoWork(DoWorkEventArgs e)
        {  
            ReportProgress(0, SortingState.Start);

            TableController tableController = new TableController();
            AudioFileInfo audioFile  = new AudioFileInfo();
            
            tableController.InsertInitialize();

            while (FileListEnumerator.MoveNext())
            { 
                if (CancellationPending)
                {
                    e.Cancel = true;
                    break;
                } 
                
                FileInfo currentFile = new FileInfo(FileListEnumerator.Key.ToString());

                audioFile.GetInfo(currentFile);
                tableController.Insert(currentFile, audioFile);
            }

            ReportProgress(100, "Done!");
            e.Result = SortingState.Completed;
        }
Example #2
0
        private void FillDataGridViewWithFilter()
        {
            tableController = new TableController();

            string album = string.Empty;
            string artist = string.Empty;
            string genre = string.Empty;
            string fileName = string.Empty;

            if (albumComboBox.SelectedItem != null)
            {
                album = Convert.ToString(this.albumComboBox.SelectedItem);
                artistComboBox.SelectedItem = null;
                genreComboBox.SelectedItem = null;
                fileNameComboBox.SelectedItem = null;
            }

            if (artistComboBox.SelectedItem != null)
            {
                artist = Convert.ToString(this.artistComboBox.SelectedItem);
                genreComboBox.SelectedItem = null;
                fileNameComboBox.SelectedItem = null;
                albumComboBox.SelectedItem = null;
            }

            if (genreComboBox.SelectedItem != null)
            {
                genre = Convert.ToString(this.genreComboBox.SelectedItem);
                artistComboBox.SelectedItem = null;
                fileNameComboBox.SelectedItem = null;
                albumComboBox.SelectedItem = null;
            }

            if (fileNameComboBox.SelectedItem != null)
            {
                fileName = Convert.ToString(this.fileNameComboBox.SelectedItem);
                artistComboBox.SelectedItem = null;
                albumComboBox.SelectedItem = null;
                genreComboBox.SelectedItem = null;
            }

            try
            {
                object datasource =
                    (tableController.GetCustomizedViewByTableName(
                    (int)pageSizeNumericUpDown.Value,
                    currentPage,
                    album,
                    artist,
                    genre,
                    fileName));
                if (datasource != null)
                {
                    mainDataGridView.DataSource = datasource;
                }
            }
            catch (Exception exception)
            {
            }
        }
Example #3
0
        private void FillComboBoxWithData()
        {
            tableController = new TableController();
            if (artistComboBox.Items.Count > 0)
            {
                artistComboBox.Items.Clear();
            }
            artistComboBox.Items.AddRange(
               tableController.GetListByTableName(TableList.Artist).ToArray());


            if (albumComboBox.Items.Count > 0)
            {
                albumComboBox.Items.Clear();
            }
            albumComboBox.Items.AddRange(
               tableController.GetListByTableName(TableList.Album).ToArray());


            if (genreComboBox.Items.Count > 0)
            {
                genreComboBox.Items.Clear();
            }
            genreComboBox.Items.AddRange(
               tableController.GetListByTableName(TableList.Genre).ToArray());

            if (fileNameComboBox.Items.Count > 0)
            {
                fileNameComboBox.Items.Clear();
            }
            fileNameComboBox.Items.AddRange(
                 tableController.GetListByTableName(TableList.FileName).ToArray());
        }
Example #4
0
        private void FillComboBoxWithData()
        {
            tableController = new TableController();
            if (artistComboBox.Items.Count > 0)
            {
                artistComboBox.Items.Clear();
            }

            foreach (Model.SimpleTable value in tableController.GetListByTableName(TableList.Artist))
            {
                artistComboBox.Items.Add(value.Name);
            }

            if (albumComboBox.Items.Count > 0)
            {
                albumComboBox.Items.Clear();
            }

            foreach (Model.SimpleTable value in tableController.GetListByTableName(TableList.Album))
            {
                albumComboBox.Items.Add(value.Name);
            }

            if (genreComboBox.Items.Count > 0)
            {
                genreComboBox.Items.Clear();
            }

            foreach (Model.SimpleTable value in tableController.GetListByTableName(TableList.Genre))
            {
                genreComboBox.Items.Add(value.Name);
            }

            if (fileNameComboBox.Items.Count > 0)
            {
                fileNameComboBox.Items.Clear();
            }

            foreach (Model.SimpleTable value in tableController.GetListByTableName(TableList.FileName))
            {
                fileNameComboBox.Items.Add(value.Name);
            }

        }
Example #5
0
 public mainForm()
 {
     InitializeComponent();
     tableController = new TableController();
 }