Exemple #1
0
        /// <summary>
        /// Handles the SelectionChanged event of the grdViewByTitle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void GrdViewByTitle_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            var rows = grdViewByTitle.GetSelectedRows();

            this.UpdatedSelectedMoviesInFactory(rows);

            if (rows.Length == 1)
            {
                MovieDBFactory.IsMultiSelected = false;

                var selectedRow = grdViewByTitle.GetRow(rows[0]) as MovieModel;

                if (MovieDBFactory.IsSameAsCurrentMovie(selectedRow))
                {
                    return;
                }

                MovieDBFactory.SetCurrentMovie(selectedRow);
            }
            else if (rows.Length > 1)
            {
                MovieDBFactory.IsMultiSelected = true;
                MovieDBFactory.SetCurrentMovie(
                    new MovieModel {
                    Title = "Mutiple Movies Selected", MultiSelectModel = true
                });
            }
        }
        /// <summary>
        /// The update movie from grid.
        /// </summary>
        private void UpdateMovieFromGrid()
        {
            var rows = this.grdViewByTitle.GetSelectedRows();

            this.UpdatedSelectedMoviesInFactory(rows);

            btnMutliWatchedFalse.Visible     = rows.Length != 1;
            this.btnMultiWatchedTrue.Visible = rows.Length != 1;
            btnWatched.Visible = rows.Length == 1;

            if (rows.Length == 1)
            {
                MovieDBFactory.IsMultiSelected = false;

                var selectedRow = this.grdViewByTitle.GetRow(rows[0]) as MovieModel;

                if (MovieDBFactory.IsSameAsCurrentMovie(selectedRow))
                {
                    return;
                }

                MovieDBFactory.SetCurrentMovie(selectedRow);
            }
            else if (rows.Length > 1)
            {
                MovieDBFactory.IsMultiSelected = true;
                MovieDBFactory.SetCurrentMovie(
                    new MovieModel {
                    Title = "Multiple Movies Selected", MultiSelectModel = true
                });
            }
        }
        private void popupHide_ItemClick(object sender, ItemClickEventArgs e)
        {
            var check = XtraMessageBox.Show("Are you sure you wish to hide the selected movies?", "Remove Movies", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (check == DialogResult.Yes)
            {
                this.grdViewByTitle.GetSelectedRows().Select(row => this.grdViewByTitle.GetRow(row) as MovieModel).
                ToList().ForEach(MovieDBFactory.HideMovie);
            }

            var movieModel = grdViewByTitle.GetFocusedRow() as MovieModel;

            MovieDBFactory.SetCurrentMovie(movieModel);
        }
Exemple #4
0
 /// <summary>
 /// Handles the Click event of the GalleryItem control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs"/> instance containing the event data.</param>
 private void GalleryItem_Click(object sender, GalleryItemClickEventArgs e)
 {
     MovieDBFactory.SetCurrentMovie(e.Item.Tag.ToString());
 }