Пример #1
0
 /// <summary>
 /// Fired when new artist is commited to DB via background importer thread
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="action"></param>
 private void mvStatusChangedListener(MusicVideoMatch obj, MusicVideoImporterAction action)
 {
     if (action == MusicVideoImporterAction.COMMITED)
       {
     LastThreeVideos();
       }
       return;
 }
Пример #2
0
        private void mvStatusChangedListener(MusicVideoMatch obj, MusicVideoImporterAction action)
        {
            // This ensures we are thread safe. Makes sure this method is run by
              // the thread that created this panel.
              if (InvokeRequired)
              {
            Delegate method = new MusicVideoImporter.MusicVideoStatusChangedHandler(mvStatusChangedListener);
            object[] parameters = new object[] { obj, action };
            this.Invoke(method, parameters);
            return;
              }

              if (action == MusicVideoImporterAction.STARTED)
            return;

              if (action == MusicVideoImporterAction.COMMITED)
              {
            ReloadList();
              }

              if (action == MusicVideoImporterAction.MANUAL)
              {
            ReloadList();
              }

              if (action == MusicVideoImporterAction.STOPPED)
              {
            unapprovedMatchesBindingSource.Clear();
            return;
              }

              if (action == MusicVideoImporterAction.REMOVED_FROM_SPLIT ||
              action == MusicVideoImporterAction.REMOVED_FROM_JOIN)
              {

            lastSplitJoinLocation = unapprovedMatchesBindingSource.IndexOf(obj);
            unapprovedMatchesBindingSource.Remove(obj);
            clearSelection = true;
            return;
              }

              // add the match if necessary and grab the row number
              int rowNum;
              if (action == MusicVideoImporterAction.ADDED)
            rowNum = unapprovedMatchesBindingSource.Add(obj);
              else if (action == MusicVideoImporterAction.ADDED_FROM_SPLIT ||
               action == MusicVideoImporterAction.ADDED_FROM_JOIN)
              {

            unapprovedMatchesBindingSource.Insert(lastSplitJoinLocation, obj);
            if (clearSelection)
            {
              unapprovedGrid.ClearSelection();
              clearSelection = false;
            }
            unapprovedGrid.Rows[lastSplitJoinLocation].Selected = true;

            rowNum = lastSplitJoinLocation;
            lastSplitJoinLocation++;
              }
              else
            rowNum = unapprovedMatchesBindingSource.IndexOf(obj);

              if (action == MusicVideoImporterAction.PARSERDONE)
              {
            mvCentralCore.Importer.StopParse();
            return;
              }

              if (action == MusicVideoImporterAction.PARSER)
              {
            //                TestParsingFillList();
            //                lvParsingResults.ListViewItemSorter = parseResult.Comparer;
            //                lvParsingResults.Sort();
            parseResult p = mvCentralCore.Importer.ParseResult[dgvParser.RowCount];
            if (p != null)
            {
              rowNum = ParserBindingSource.Add(p);
              //                dgvParser.CurrentCell. .Style.BackColor item.UseItemStyleForSubItems = false;
              if (p.failedArtist)
            dgvParser.Rows[rowNum].Cells["colParseArtist"].Style.BackColor = System.Drawing.Color.Tomato;
              if (p.failedTrack)
            dgvParser.Rows[rowNum].Cells["colParseTrack"].Style.BackColor = System.Drawing.Color.Tomato;
            }
            return;
              }

              // setup tooltip for filename
              DataGridViewTextBoxCell filenameCell = (DataGridViewTextBoxCell)unapprovedGrid.Rows[rowNum].Cells["unapprovedLocalMediaColumn"];
              filenameCell.ToolTipText = obj.LongLocalMediaString;

              // setup the combo box of possible matches
              DataGridViewComboBoxCell movieListCombo = (DataGridViewComboBoxCell)unapprovedGrid.Rows[rowNum].Cells["unapprovedPossibleMatchesColumn"];
              movieListCombo.Items.Clear();
              foreach (PossibleMatch currMatch in obj.PossibleMatches)
            movieListCombo.Items.Add(currMatch);

              // set the status icon
              DataGridViewImageCell imageCell = (DataGridViewImageCell)unapprovedGrid.Rows[rowNum].Cells["statusColumn"];
              switch (action)
              {
            case MusicVideoImporterAction.ADDED:
            case MusicVideoImporterAction.ADDED_FROM_SPLIT:
            case MusicVideoImporterAction.ADDED_FROM_JOIN:
              imageCell.Value = blank;
              break;
            case MusicVideoImporterAction.PENDING:
              imageCell.Value = Resources.arrow_rotate_clockwise;
              break;
            case MusicVideoImporterAction.GETTING_MATCHES:
              imageCell.Value = Resources.arrow_down_small;
              break;
            case MusicVideoImporterAction.NEED_INPUT:
              imageCell.Value = Resources.Information;
              break;
            case MusicVideoImporterAction.APPROVED:
              imageCell.Value = Resources.approved;
              break;
            case MusicVideoImporterAction.GETTING_DETAILS:
              imageCell.Value = Resources.approved;
              break;
            case MusicVideoImporterAction.COMMITED:
              imageCell.Value = Resources.accept;
              break;
            case MusicVideoImporterAction.IGNORED:
              imageCell.Value = Resources.ignored;
              break;
            case MusicVideoImporterAction.MANUAL:
              imageCell.Value = Resources.accept; // @TODO change icon
              break;
              }
              tcImport.SelectedTab = tpMatch;

              unapprovedGrid.Focus();
              updateButtons();
        }