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;
            }
        }
        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
        /// <summary>
        /// Receives updates about specific items in the importer and updates the UI accordingly.
        /// </summary>
        private void MovieStatusChangedListener(MovieMatch match, MovieImporterAction action)
        {
            lock (statusChangedSyncToken) {
                // if the importer fired up or shut down clear out our display
                if (action == MovieImporterAction.STARTED || action == MovieImporterAction.STOPPED) {
                    allItems.Clear();
                    pendingItems.Clear();
                    completedItems.Clear();

                    listItemLookup.Clear();
                    allFilesListControl.ListItems.Clear();
                    pendingFilesListControl.ListItems.Clear();
                    completedFileListControl.ListItems.Clear();
                    return;
                }

                // our message is about a specific match
                GUIListItem listItem = GetListItem(match);
                AddToList(listItem, FilterMode.ALL);

                switch (action) {
                    // file is queued but not yet processed have no icon
                    case MovieImporterAction.ADDED:
                    case MovieImporterAction.ADDED_FROM_SPLIT:
                    case MovieImporterAction.ADDED_FROM_JOIN:
                        listItem.PinImage = IdleIcon;
                        break;

                    // files that are currently being scanned are blue
                    case MovieImporterAction.PENDING:
                    case MovieImporterAction.GETTING_MATCHES:
                    case MovieImporterAction.APPROVED:
                    case MovieImporterAction.GETTING_DETAILS:
                        listItem.PinImage = ProcessingIcon;
                        break;

                    // files that need help from the user are yellow
                    case MovieImporterAction.NEED_INPUT:
                        listItem.PinImage = NeedInputIcon;
                        AddToList(listItem, FilterMode.PENDING);
                        break;

                    // files that have successfully imported are green
                    case MovieImporterAction.COMMITED:
                        listItem.PinImage = DoneIcon;
                        AddToList(listItem, FilterMode.COMPLETED);
                        RemoveFromList(listItem, FilterMode.PENDING);
                        break;

                    case MovieImporterAction.IGNORED:
                        listItem.PinImage = IgnoredIcon;
                        AddToList(listItem, FilterMode.PENDING);
                        RemoveFromList(listItem, FilterMode.COMPLETED);
                        break;
                }

                UpdateArtwork();
            }
        }
Пример #4
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();
        }
Пример #5
0
        /// <summary>
        /// Receives updates about specific items in the importer and updates the UI accordingly.
        /// </summary>
        private void MovieStatusChangedListener(MovieMatch match, MovieImporterAction action)
        {
            lock (statusChangedSyncToken) {
                // if the importer fired up or shut down clear out our display
                if (action == MovieImporterAction.STARTED || action == MovieImporterAction.STOPPED)
                {
                    allItems.Clear();
                    pendingItems.Clear();
                    completedItems.Clear();

                    listItemLookup.Clear();
                    allFilesListControl.ListItems.Clear();
                    pendingFilesListControl.ListItems.Clear();
                    completedFileListControl.ListItems.Clear();
                    return;
                }

                // our message is about a specific match
                GUIListItem listItem = GetListItem(match);
                AddToList(listItem, FilterMode.ALL);

                switch (action)
                {
                // file is queued but not yet processed have no icon
                case MovieImporterAction.ADDED:
                case MovieImporterAction.ADDED_FROM_SPLIT:
                case MovieImporterAction.ADDED_FROM_JOIN:
                    listItem.PinImage = IdleIcon;
                    break;

                // files that are currently being scanned are blue
                case MovieImporterAction.PENDING:
                case MovieImporterAction.GETTING_MATCHES:
                case MovieImporterAction.APPROVED:
                case MovieImporterAction.GETTING_DETAILS:
                    listItem.PinImage = ProcessingIcon;
                    break;

                // files that need help from the user are yellow
                case MovieImporterAction.NEED_INPUT:
                    listItem.PinImage = NeedInputIcon;
                    AddToList(listItem, FilterMode.PENDING);
                    break;

                // files that have successfully imported are green
                case MovieImporterAction.COMMITED:
                    listItem.PinImage = DoneIcon;
                    AddToList(listItem, FilterMode.COMPLETED);
                    RemoveFromList(listItem, FilterMode.PENDING);
                    break;

                case MovieImporterAction.IGNORED:
                    listItem.PinImage = IgnoredIcon;
                    AddToList(listItem, FilterMode.PENDING);
                    RemoveFromList(listItem, FilterMode.COMPLETED);
                    break;
                }

                UpdateArtwork();
            }
        }
Пример #6
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;
            }
        }