Esempio n. 1
0
        /// <author>Kenneth Søhrmann</author>
        /// <summary>
        /// EventHandler for the Movie details-button. Loads an BookMovieDetails-instance
        /// into the MainForm displaying the metadata of the movie.
        /// </summary>
        private void viewMovieDetails_Click(object sender, System.EventArgs e)
        {
            if (this.movieDetails == null)
            {
                this.movieDetails = new BookMovieDetails()
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    MovieInfo = this.movie
                };
            }

            this.FireContentChangeEvent(movieDetails, MainForm.Titles.MediaDetailsMovie);
        }
Esempio n. 2
0
        /// <summary>
        /// Go to media details context if "new and hot" item is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewAndHotClick(object sender, MouseEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            MediaInfo mediaInfo = this.newAndHotMedia;

            RentItUserControl mediaDetail;
            string title;

            if (this.Mtype == MediaType.Album)
            {
                mediaDetail = new AlbumDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    AlbumInfo = (AlbumInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsAlbum;
            }
            else if (this.Mtype == MediaType.Movie)
            {
                mediaDetail = new BookMovieDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    MovieInfo = (MovieInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsMovie;
            }
            else if (this.Mtype == MediaType.Book)
            {
                mediaDetail = new BookMovieDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    BookInfo = (BookInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsBook;
            }
            else return;

            FireContentChangeEvent(mediaDetail, title);

            Cursor.Current = Cursors.Default;
        }
Esempio n. 3
0
        /// <summary>
        /// Double click event to handle clicking on media items in the list. 
        /// The user will be redirected to the respective media page by firing a contentchange-event.
        /// </summary>
        private void DoubleClickEventHandler(object obj, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (this.mediaListView.SelectedItems.Count != 1)
            {
                return;
            }

            var mediaInfo = this.mediaList[mediaListView.SelectedIndex];

            switch (mediaInfo.Type)
            {
                case MediaType.Album:
                    var albumDetails = new AlbumDetails
                    {
                        RentItProxy = this.RentItProxy,
                        Credentials = this.Credentials,
                        AlbumInfo = (AlbumInfo)mediaInfo
                    };
                    this.FireContentChangeEvent(albumDetails, MainForm.Titles.MediaDetailsAlbum);
                    break;
                case MediaType.Book:
                    var bookDetails = new BookMovieDetails
                    {
                        RentItProxy = this.RentItProxy,
                        Credentials = this.Credentials,
                        BookInfo = (BookInfo)mediaInfo
                    };
                    this.FireContentChangeEvent(bookDetails, MainForm.Titles.MediaDetailsBook);
                    break;
                case MediaType.Movie:
                    var movieDetails = new BookMovieDetails
                    {
                        RentItProxy = this.RentItProxy,
                        Credentials = this.Credentials,
                        MovieInfo = (MovieInfo)mediaInfo
                    };
                    this.FireContentChangeEvent(movieDetails, MainForm.Titles.MediaDetailsMovie);
                    break;
            }

            Cursor.Current = Cursors.Default;
        }
Esempio n. 4
0
        /// <author>Kenneth Søhrmann</author>
        /// <summary>
        /// EventHandler for the Book details-button. Loads an BookMovieDetails-instance
        /// into the MainForm displaying the metadata of the book.
        /// </summary>
        private void viewBookDetails_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (this.bookDetails == null)
            {
                this.bookDetails = new BookMovieDetails()
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    BookInfo = this.book
                };
            }

            this.FireContentChangeEvent(bookDetails, MainForm.Titles.MediaDetailsBook);
            Cursor.Current = Cursors.Default;
        }
Esempio n. 5
0
        /// <summary>
        /// EventHandler for handling double clicks on the MediaGrid.
        /// Depending on the type of the clicked media, the corresponding
        /// UserControl for displayed media metadata (AlbumDetails for media of 
        /// type album, and BookMovieDetails for media of type either book or movie)
        /// will be displayed in the MainForm.
        /// </summary>
        private void DoubleClickEventHandler(object obj, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (this.ListViewGrid.SelectedItems.Count != 1)
            {
                return;
            }

            ListViewItem selectedItem = this.ListViewGrid.SelectedItems[0];
            var mediaInfo = (MediaInfo)selectedItem.Tag;

            RentItUserControl mediaDetail;
            string title;

            if (this.mediaCriteria.Type == MediaType.Album)
            {
                mediaDetail = new AlbumDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    AlbumInfo = (AlbumInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsAlbum;
            }
            else if (this.mediaCriteria.Type == MediaType.Movie)
            {
                mediaDetail = new BookMovieDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    MovieInfo = (MovieInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsMovie;
            }
            else if (this.mediaCriteria.Type == MediaType.Book)
            {
                mediaDetail = new BookMovieDetails
                {
                    RentItProxy = this.RentItProxy,
                    Credentials = this.Credentials,
                    BookInfo = (BookInfo)mediaInfo
                };
                title = MainForm.Titles.MediaDetailsBook;
            }
            else return;

            FireContentChangeEvent(mediaDetail, title);

            Cursor.Current = Cursors.Default;
        }
Esempio n. 6
0
        /// <summary>
        /// Switches to a media details screen, depending on the type
        /// of media selected.
        /// </summary>
        /// <param name="media">The media to open a details page for.</param>
        private void DisplayMediaItem(MediaInfo media)
        {
            Cursor.Current = Cursors.WaitCursor;

            RentItUserControl mediaDetails;
            string title;
            switch (media.Type)
            {
                case MediaType.Album:
                    mediaDetails = new AlbumDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            AlbumInfo = (AlbumInfo)media
                        };
                    title = MainForm.Titles.MediaDetailsAlbum;
                    break;
                case MediaType.Book:
                    mediaDetails = new BookMovieDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            BookInfo = (BookInfo)media
                        };
                    title = MainForm.Titles.MediaDetailsBook;
                    break;
                case MediaType.Movie:
                    mediaDetails = new BookMovieDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            MovieInfo = (MovieInfo)media
                        };
                    title = MainForm.Titles.MediaDetailsMovie;
                    break;
                default:
                    return;
            }

            FireContentChangeEvent(mediaDetails, title);

            Cursor.Current = Cursors.Default;
        }
Esempio n. 7
0
        /// <summary>
        /// Changes the window content to display details about a media item.
        /// </summary>
        /// <param name="media">The item to display details of.</param>
        private void DisplayMediaItem(MediaInfo media)
        {
            RentItUserControl mediaDetails;
            string title;
            switch (media.Type)
            {
                case MediaType.Album:
                    mediaDetails = new AlbumDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            AlbumInfo = (AlbumInfo)media
                        };
                    title = "Album details";
                    break;
                case MediaType.Book:
                    mediaDetails = new BookMovieDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            BookInfo = (BookInfo)media
                        };
                    title = "Book details";
                    break;
                case MediaType.Movie:
                    mediaDetails = new BookMovieDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            MovieInfo = (MovieInfo)media
                        };
                    title = "Movie details";
                    break;
                case MediaType.Song:
                    mediaDetails = new AlbumDetails
                        {
                            RentItProxy = RentItProxy,
                            Credentials = Credentials,
                            AlbumInfo = RentItProxy.GetAlbumInfo(((SongInfo)media).AlbumId)
                        };
                    title = "Album details";
                    break;
                default:
                    return;
            }

            FireContentChangeEvent(mediaDetails, title);
        }
Esempio n. 8
0
        /// <summary>
        /// EventHandler of the DoubleClickEvent of the list displaying
        /// published media. The double click will display either a AlbumDetails
        /// or BookMovieDetails (depending of the type of the clicked media) in
        /// the MainForm.
        /// </summary>
        private void DoubleClickEventHandler(object obj, EventArgs e)
        {
            MediaInfo mediaInfo = this.publishedMediaList.GetSingleMedia();

            if (mediaInfo == null)
            {
                return;
            }

            RentItUserControl mediaDetail;
            string title;

            switch (mediaInfo.Type)
            {
                case MediaType.Album:
                    var albumDetails = new AlbumDetails
                        {
                            RentItProxy = this.RentItProxy,
                            Credentials = this.Credentials,
                            AlbumInfo = (AlbumInfo)mediaInfo
                        };
                    mediaDetail = albumDetails;
                    title = MainForm.Titles.MediaDetailsAlbum;
                    break;
                case MediaType.Movie:
                    var movieDetails = new BookMovieDetails
                        {
                            RentItProxy = this.RentItProxy,
                            Credentials = this.Credentials,
                            MovieInfo = (MovieInfo)mediaInfo
                        };
                    mediaDetail = movieDetails;
                    title = MainForm.Titles.MediaDetailsMovie;
                    break;
                case MediaType.Book:
                    var bookDetails = new BookMovieDetails
                        {
                            RentItProxy = this.RentItProxy,
                            Credentials = this.Credentials,
                            BookInfo = (BookInfo)mediaInfo
                        };
                    mediaDetail = bookDetails;
                    title = MainForm.Titles.MediaDetailsBook;
                    break;
                default:
                    return;
            }

            this.FireContentChangeEvent(mediaDetail, title);
        }