Ejemplo n.º 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
                });
            }
        }
Ejemplo n.º 2
0
        /// <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
                });
            }
        }