コード例 #1
0
        private void movieStatusChangedListener(MovieMatch obj, MovieImporterAction action)
        {
            // we dont care about any messages except those about media matches
            if (obj == null)
                return;

            // This ensures we are thread safe. Makes sure this method is run by
            // the thread that created this panel.
            if (InvokeRequired) {
                Delegate method = new MovieImporter.MovieStatusChangedHandler(movieStatusChangedListener);
                object[] parameters = new object[] { obj, action };
                this.Invoke(method, parameters);
                return;
            }

            // if this is not a message about our files ignore it
            if (!obj.LocalMedia.Contains(localMedia[0]))
                return;

            // store the current match
            mediaMatch = obj;

            switch (action) {
                case MovieImporterAction.ADDED:
                case MovieImporterAction.PENDING:
                    statusLabel.Text = "Possible match retrieval pending...";
                    break;
                case MovieImporterAction.GETTING_MATCHES:
                    statusLabel.Text = "Retrieving possible matches...";
                    break;
                case MovieImporterAction.NEED_INPUT:
                    updateCombo();

                    // auto choose the default (mainly to pull in metadata. we can
                    // easily undo if the user picks another movie.
                    mediaMatch.Selected = (PossibleMatch)possibleMatchesCombo.SelectedItem;
                    mediaMatch.HighPriority = true;
                    MovingPicturesCore.Importer.Approve(mediaMatch);

                    break;
                case MovieImporterAction.APPROVED:
                    statusLabel.Text = "Close match found...";
                    updateCombo();
                    break;
                case MovieImporterAction.GETTING_DETAILS:
                    statusLabel.Text = "Retrieving movie details...";
                    break;
                case MovieImporterAction.COMMITED:
                    statusLabel.Text = "Match commited...";
                    movieDetails.DatabaseObject = mediaMatch.Selected.Movie;
                    break;
            }
        }
コード例 #2
0
        private void movieStatusChangedListener(MovieMatch obj, MovieImporterAction 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 MovieImporter.MovieStatusChangedHandler(movieStatusChangedListener);
                object[] parameters = new object[] { obj, action };
                this.Invoke(method, parameters);
                return;
            }

            if (action == MovieImporterAction.STARTED)
                return;

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

            if (action == MovieImporterAction.REMOVED_FROM_SPLIT ||
                action == MovieImporterAction.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 == MovieImporterAction.ADDED)
                rowNum = unapprovedMatchesBindingSource.Add(obj);
            else if (action == MovieImporterAction.ADDED_FROM_SPLIT ||
                     action == MovieImporterAction.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);

            // 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 MovieImporterAction.ADDED:
                case MovieImporterAction.ADDED_FROM_SPLIT:
                case MovieImporterAction.ADDED_FROM_JOIN:
                    imageCell.Value = blank;
                    break;
                case MovieImporterAction.PENDING:
                    imageCell.Value = Resources.arrow_rotate_clockwise;
                    break;
                case MovieImporterAction.GETTING_MATCHES:
                    imageCell.Value = Resources.arrow_down1;
                    break;
                case MovieImporterAction.NEED_INPUT:
                    imageCell.Value = Resources.information;
                    break;
                case MovieImporterAction.APPROVED:
                    imageCell.Value = Resources.approved;
                    break;
                case MovieImporterAction.GETTING_DETAILS:
                    imageCell.Value = Resources.approved;
                    break;
                case MovieImporterAction.COMMITED:
                    imageCell.Value = Resources.accept;
                    break;
                case MovieImporterAction.IGNORED:
                    imageCell.Value = Resources.ignored;
                    break;
                case MovieImporterAction.MANUAL:
                    imageCell.Value = Resources.accept; // @TODO change icon
                    break;
            }

            updateButtons();
        }
コード例 #3
0
        private void movieStatusChangedListener(MovieMatch obj, MovieImporterAction 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 MovieImporter.MovieStatusChangedHandler(movieStatusChangedListener);
                object[] parameters = new object[] { obj, action };
                this.Invoke(method, parameters);
                return;
            }

            if (action == MovieImporterAction.STARTED)
            {
                return;
            }

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

            if (action == MovieImporterAction.REMOVED_FROM_SPLIT ||
                action == MovieImporterAction.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 == MovieImporterAction.ADDED)
            {
                rowNum = unapprovedMatchesBindingSource.Add(obj);
            }
            else if (action == MovieImporterAction.ADDED_FROM_SPLIT ||
                     action == MovieImporterAction.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 (rowNum == -1)
            {
                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 MovieImporterAction.ADDED:
            case MovieImporterAction.ADDED_FROM_SPLIT:
            case MovieImporterAction.ADDED_FROM_JOIN:
                imageCell.Value = blank;
                break;

            case MovieImporterAction.PENDING:
                imageCell.Value = Resources.arrow_rotate_clockwise;
                break;

            case MovieImporterAction.GETTING_MATCHES:
                imageCell.Value = Resources.arrow_down1;
                break;

            case MovieImporterAction.NEED_INPUT:
                imageCell.Value = Resources.information;
                break;

            case MovieImporterAction.APPROVED:
                imageCell.Value = Resources.approved;
                break;

            case MovieImporterAction.GETTING_DETAILS:
                imageCell.Value = Resources.approved;
                break;

            case MovieImporterAction.COMMITED:
                imageCell.Value = Resources.accept;
                break;

            case MovieImporterAction.IGNORED:
                imageCell.Value = Resources.ignored;
                break;

            case MovieImporterAction.MANUAL:
                imageCell.Value = Resources.accept;     // @TODO change icon
                break;
            }

            updateButtons();
        }
コード例 #4
0
        private void movieStatusChangedListener(MovieMatch obj, MovieImporterAction action)
        {
            // we dont care about any messages except those about media matches
            if (obj == null)
            {
                return;
            }

            // This ensures we are thread safe. Makes sure this method is run by
            // the thread that created this panel.
            if (InvokeRequired)
            {
                Delegate method     = new MovieImporter.MovieStatusChangedHandler(movieStatusChangedListener);
                object[] parameters = new object[] { obj, action };
                this.Invoke(method, parameters);
                return;
            }

            // if this is not a message about our files ignore it
            if (!obj.LocalMedia.Contains(localMedia[0]))
            {
                return;
            }

            // store the current match
            mediaMatch = obj;

            switch (action)
            {
            case MovieImporterAction.ADDED:
            case MovieImporterAction.PENDING:
                statusLabel.Text = "Possible match retrieval pending...";
                break;

            case MovieImporterAction.GETTING_MATCHES:
                statusLabel.Text = "Retrieving possible matches...";
                break;

            case MovieImporterAction.NEED_INPUT:
                updateCombo();

                // auto choose the default (mainly to pull in metadata. we can
                // easily undo if the user picks another movie.
                mediaMatch.Selected     = (PossibleMatch)possibleMatchesCombo.SelectedItem;
                mediaMatch.HighPriority = true;
                MovingPicturesCore.Importer.Approve(mediaMatch);

                break;

            case MovieImporterAction.APPROVED:
                statusLabel.Text = "Close match found...";
                updateCombo();
                break;

            case MovieImporterAction.GETTING_DETAILS:
                statusLabel.Text = "Retrieving movie details...";
                break;

            case MovieImporterAction.COMMITED:
                statusLabel.Text            = "Match commited...";
                movieDetails.DatabaseObject = mediaMatch.Selected.Movie;
                break;
            }
        }