Ejemplo n.º 1
0
        // Events
        void OnLoad(object sender, EventArgs e)
        {
            CreateControlsFromTemplate(template, panelMovies, "movie", movies, itemsPerPage);
            BindingManager.AddOrderingBinding(filterSortOrder);
            BindingManager.AddSortByWatchlistBinding(filterSortBy);

            Height = Program.formHeight;

            for (int i = 0; i < itemsPerPage; i++)
            {
                var movie = movies[i];
                var curi  = i;
                movie.Controls["buttonReviews"].Click += (object s, EventArgs ee) => {
                    Program.OpenMovieForm(moviesData[curi].id);
                };
                movie.Controls["buttonRemove"].Click += (object s, EventArgs ee) => {
                    MovieManager.RemoveFromWatchlist(moviesData[curi].watchlistId);
                };
                movie.Controls["buttonAddToWatched"].Click += (object s, EventArgs ee) => {
                    if (radioReviewed.Checked)
                    {
                        MovieManager.AddToWatchList(moviesData[curi].id);
                    }
                    else
                    {
                        MovieManager.SetWatchedStatus(moviesData[curi].watchlistId, radioUnwatched.Checked);
                    }
                };
            }

            LoadWatchlist();
        }
Ejemplo n.º 2
0
        // Events
        void OnLoad(object sender, EventArgs e)
        {
            CreateControlsFromTemplate(template, panelMovies, "movie", movies, itemsPerPage);

            BindingManager.AddGenresToDropdown(filterGenre, true);
            BindingManager.AddOrderingBinding(filterSortOrder);
            BindingManager.AddSortByMoviesBinding(filterSortBy);
            BindingManager.AddRatingBinding(filterRating);
            buttonWatchlist.DataBindings.Add("Enabled", Profile.IsLoggedIn, "Checked");
            buttonAddMovie.DataBindings.Add("Enabled", Profile.IsAdmin, "Checked");
            buttonLogin.DataBindings.Add(BindingManager.GetFormattedBindingLoggedIn("Text"));

            for (int i = 0; i < itemsPerPage; i++)
            {
                var movie = movies[i];
                var curi  = i;
                movie.Controls["buttonReviews"].Click += (object s, EventArgs ee) => {
                    Program.OpenMovieForm(moviesData[curi].id);
                };
                movie.Controls["buttonAddToWatchlist"].Click += (object s, EventArgs ee) => {
                    MovieManager.AddToWatchList(moviesData[curi].id);
                };
                movie.Controls["buttonEditMovie"].DataBindings.Add("Visible", Profile.IsAdmin, "Checked");
                movie.Controls["buttonEditMovie"].DataBindings.Add("Enabled", Profile.IsAdmin, "Checked");
                movie.Controls["buttonEditMovie"].Click += (object s, EventArgs ee) => {
                    new FormAddMovie(moviesData[curi].id).ShowDialog();
                };
            }
        }
Ejemplo n.º 3
0
        // Click events
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (movieId != -1)
            {
                if (MovieManager.UpdateMovie(
                        movieData.id,
                        addTitle.Text,
                        addYear.Value,
                        addGenre.SelectedValue,
                        addDuration.Value,
                        addDirector.Text,
                        addStars.Text,
                        addDescription.Text,
                        movieData.poster,
                        addPosterPath.Text == posterExistsText ? null : addPosterPath.Text
                        ))
                {
                    Close();
                }
            }
            else
            {
                var id = MovieManager.AddMovie(
                    addTitle.Text,
                    addYear.Value,
                    addGenre.SelectedValue,
                    addDuration.Value,
                    addDirector.Text,
                    addStars.Text,
                    addDescription.Text,
                    addPosterPath.Text
                    );

                if (id != -1)
                {
                    Program.OpenMovieForm(id);
                    Close();
                }
            }
        }
Ejemplo n.º 4
0
 private void buttonAddToWatchlist_Click(object sender, EventArgs e)
 {
     MovieManager.AddToWatchList(id);
 }
Ejemplo n.º 5
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     Close();
     MovieManager.DeleteMovie(movieId);
 }